
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Find whitespace character in string using "index_of" function

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi Christian,
did you find a solution to this?
I am struggeling with the same issue, wanting to find the possition of the first BLANK/WHITESPACE in a string.
When creating the variable and test it with a teststring and simply entering a black (hitting space key) as the delimiter, everything seems to work fine.
But on actual data this does not seem to work.
Thanks for your response,
Markus

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
I remember a thread from a couple months ago where the focus was on or turned to finding whitespace characters. I have done a little searching on the forums but can’t seem to find it. Doesn’t help the search engine doesn’t play nice with word stemming (eg., space matches space; it doesn’t match spaces).

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi Christian,
i found a solution which works at least, if there is a character following your whitespace which could be interpreted as part of the seperator as well.
See what i mean:
I want to get the last position of a " " (blank) in a string with indexOf.
I created a variable, selected a base string field and typed a blank (just hitting space key once in the second argument field).
Before saving, i tested it with the calucate feature which gave me the feeling everything would work fine.
On acutal data my "indexOf Variable" was empty.
Obviously the problem is, that the blank in the string field gets stripped when saving the variable.
I was in the lucky position, that my seperator is acutally a [BLANK]-[BLANK]
So when using [BLANK]-[BLANK] as delimiter, the second blank gets stripped either way, but the remaining rest [BLANK]- is enough to get the function working...
Maybe this helps you also,
Regards


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
I seem to recall someone suggesting using the ASCII representation of the space character (Ascii 32) entered by holding down the ALT key and entering "0032" on the numeric keyboard. I remember trying it, but don't remember my results. If this works for you, let us know. I like the trick of using "Blank", "Blank" and expecting one of them to be stripped, just remember that the next time you edit the rule, there will only be once space there and it'll also get stripped, so don't edit the rule too much.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
I think I was the one that suggested using the ASCII for a space by holding down the Alt key and hitting 255 on the numeric keypad (does not work on laptops unless numlock is turned on). It worked for me in my tests for the previous issue and may be worth trying for this as well.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Very, very nice trick

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hello All,
I found this topic today while struggling with the same issue - actually I think I found a decent working solution to the matter.
Suppose I want to split "NAME SURNAME" from Target User Name field (names are split by a blank character) in two different variables - NAME and SURNAME. What I do is the following:
1. Define a new String variable to remember Target User Name:
NAME_SURNAME = concat(Target User Name, )
2. Replace the blank character with some other character using evaluate_velocity_template(), new character that can be subsequently used with string functions. In evaluate_velocity_template() function you can use only one blank space as an argument, and it works!
NAME|SURNAME = evaluate_velocity_template($NAME_SURNAME.replaceAll(' ','|'))
3. Convert your new string into a list using as separator the new replaced character - "|":
NAME_LIST = convert_string_to_list(NAME|SURNAME, |)
And from here it is easy, just retrieve information from the list with the get_list_element() function.
The trick with writing the blank character using ASCII did not work for me - I was able to introduce the blank, but when applying it would still disappear.
Hope this helps,
Stefan