🔒 This topic is solved and locked.
Need further help from the community? Please
sign in and ask a new question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 02-06-2019 03:21 PM
(81340 views)
Hi, I have a variable called "comment" that contains a string of words that are separated by '~'
example:
comment
text text text text ~ text text
text text text text text ~ text text text ~text text
I would like to extract the text after the first ~ without losing the text behind the second or third or fourth ~ etc.
I tried using this code:
cm=scan(comment,1,"~");
But it only extracts the text after the first ~ and then stops once it reaches the second ~
Any help is much appreciated!
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Use INDEX() to find the first tilda and then use that number in SUBSTR().
Double check the order of t
cm = substr(comment, index(comment, '~') +1);
Double check the order of t
cm = substr(comment, index(comment, '~') +1);
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Use INDEX() to find the first tilda and then use that number in SUBSTR().
Double check the order of t
cm = substr(comment, index(comment, '~') +1);
Double check the order of t
cm = substr(comment, index(comment, '~') +1);
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi Reeza,
Thank you for the quick response. Out of curiosity, what does the +1 signify?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
INDEX would find the ~, so if you substring from that it includes the ~, +1 gives you the position after the first ~.