counting the words of the string

i have a sentence as a input and i want to count the words of the sentence so how i can got that output if there is any built-in-service tell me that also…



There is no built-in service for it.

Please go through


i already hve dis…i want solution not documentation

// pipeline
IDataCursor pipelineCursor = pipeline.getCursor();
String inputString = IDataUtil.getString( pipelineCursor, “inputString” );
String spaceCharacter = " ";
String outString = inputString.split(spaceCharacter);
int Words= outString.length;

	// pipeline
	IDataCursor pipelineCursor_1 = pipeline.getCursor();
	IDataUtil.put( pipelineCursor_1, "Words", Words );

write this code in your java service , and try hope it will work

The above code works fine… but you can also implement the same logic using webMethods flow service instead of java service if you need :stuck_out_tongue:

Core services used are in WmPublic pkg. :lol:

Also you can use wM inbuild service WmPublic/pub.string:substring