can someone write me a quick Java function?

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
Jaymer
Posts: 2450
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

can someone write me a quick Java function?

Post by Jaymer »

long time ago i had a function i wrote, but no idea where it is and i don't have an environment setup to do it.
simple if you have a boilerplate.

I need the count of occurrences of a string within a string.
I have a delimited string returned by a service and want to count the # of items easily.

newFunc (source_string, string_to_count)

example:
aware_field = 'AA@bb@cc@ddd@eeee@ff@gg@hh'
theNum = newFunc(aware_field, '@') /* returns 7 */
theNum = newFunc(aware_field, 'e') /* returns 4 */

will be much appreciated!
PS _ I know I could do this in a While loop - not interested
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
KnightWare
Posts: 139
Joined: Sat Feb 10, 2018 12:56 am

Re: can someone write me a quick Java function?

Post by KnightWare »

would it be

aware_field.count('@')
Jaymer
Posts: 2450
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: can someone write me a quick Java function?

Post by Jaymer »

I don’t know what kind of syntax that is, and unsure if that’s valid in aware, but yes that would be it in other languages.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
Post Reply