counting the words of the string

hello
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…

thanks

@Rohit,

There is no built-in service for it.

Please go through http://techcommunity.softwareag.com/ecosystem/documentation/webmethods/wmsuites/wmsuite8-2_sp2/Integration_Server/8-2-SP2_Integration_Server_Built-In_Services_Reference.pdf

Thanks,
Rankesh

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;
pipelineCursor.destroy();

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

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:

1 Like

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