Connecting Tech Pros Worldwide Help | Site Map

Extracting string

John
Guest
 
Posts: n/a
#1: Jul 10 '06
Hi

I have a string with two $ sign in between, like ab$cdefg$eurur. I need to
extract the right most part of the string from just right of the $ sign. How
do I do this?

Thanks

Regards


Tiago Salgado
Guest
 
Posts: n/a
#2: Jul 10 '06

re: Extracting string


Try this:

Dim str As String = "ab$cdefg$eurur"
str = str.Substring(0, str.IndexOf("$", 0))

On Mon, 10 Jul 2006 19:16:53 +0100, John <John@nospam.infovis.co.ukwrote:
Quote:
Hi
>
I have a string with two $ sign in between, like ab$cdefg$eurur. I need
to
extract the right most part of the string from just right of the $ sign.
How
do I do this?
>
Thanks
>
Regards
>
>


--
Tiago Salgado
http://www.foruns.org
Samuel Shulman
Guest
 
Posts: n/a
#3: Jul 10 '06

re: Extracting string


You may use the Split Method that will split the string based on the
character passed (in this case $)
It returns an array of string and you may choose the string that you like
(The string to the right of the right $ will have index 2 of the array)

hth,
Samuel Shulman




"John" <John@nospam.infovis.co.ukwrote in message
news:%238SuF0EpGHA.1140@TK2MSFTNGP05.phx.gbl...
Quote:
Hi
>
I have a string with two $ sign in between, like ab$cdefg$eurur. I need to
extract the right most part of the string from just right of the $ sign.
How do I do this?
>
Thanks
>
Regards
>

Oenone
Guest
 
Posts: n/a
#4: Jul 10 '06

re: Extracting string


John wrote:
Quote:
I have a string with two $ sign in between, like ab$cdefg$eurur. I
need to extract the right most part of the string from just right of
the $ sign. How do I do this?
\\\

Dim s1 As String = "ab$cdefg$eurur"
Dim s2 As String

s2 = Mid(s1, InStrRev(s1, "$") + 1)
///

--

(O)enone


Travis Sharpe
Guest
 
Posts: n/a
#5: Jul 10 '06

re: Extracting string


Oenone wrote:
Quote:
John wrote:
Quote:
>I have a string with two $ sign in between, like ab$cdefg$eurur. I
>need to extract the right most part of the string from just right of
>the $ sign. How do I do this?
>
\\\
>
Dim s1 As String = "ab$cdefg$eurur"
Dim s2 As String
>
s2 = Mid(s1, InStrRev(s1, "$") + 1)
///
>
Dim s1 As String = "ab$cdefg$eurur"
Dim temp() as string = s1.split("$")
Dim result as string = temp(2)
Dennis
Guest
 
Posts: n/a
#6: Jul 11 '06

re: Extracting string


This will get the characters(eurur) after the last $ or return all if there
are no $'s.

Dim str As String = "ab$cdefg$eurur"
str = str.Substring(str.LastIndexOf("$")+1)


--
Dennis in Houston


"John" wrote:
Quote:
Hi
>
I have a string with two $ sign in between, like ab$cdefg$eurur. I need to
extract the right most part of the string from just right of the $ sign. How
do I do this?
>
Thanks
>
Regards
>
>
>
Branco Medeiros
Guest
 
Posts: n/a
#7: Jul 11 '06

re: Extracting string


John wrote:
Quote:
I have a string with two $ sign in between, like ab$cdefg$eurur. I need to
extract the right most part of the string from just right of the $ sign. How
do I do this?
Besides all the other suggestions, you may have also:

Dim S1 As String = "ab$cdefg$eurur"
Dim S2 As String = S1.Substring(S1.LastIndexOf("$"c) + 1)

Regards,

Branco.

Larry Lard
Guest
 
Posts: n/a
#8: Jul 11 '06

re: Extracting string



John wrote:
Quote:
Hi
>
I have a string with two $ sign in between, like ab$cdefg$eurur. I need to
extract the right most part of the string from just right of the $ sign. How
do I do this?
Lots of answers, and it's great to see that no one offered a regex!
Perhaps our efforts here in the newsgroups are not all in vain...

--
Larry Lard
Replies to group please
When starting a new topic, please mention which version of VB/C# you
are using

Closed Thread