Home All Groups Group Topic Archive Search About
Author
10 Jul 2006 6:16 PM
John
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

Author
10 Jul 2006 6:27 PM
Tiago Salgado
Try this:

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

On Mon, 10 Jul 2006 19:16:53 +0100, John <John@nospam.infovis.co.uk> wro=
te:

Show quoteHide quote
> Hi
>
> I have a string with two $ sign in between, like ab$cdefg$eurur. I nee=
d  =

> to
> extract the right most part of the string from just right of the $ sig=
n.  =

> How
> do I do this?
>
> Thanks
>
> Regards
>
>



-- =

Tiago Salgado
http://www.foruns.org
Author
10 Jul 2006 6:33 PM
Samuel Shulman
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




Show quoteHide quote
"John" <John@nospam.infovis.co.uk> wrote in message
news:%238SuF0EpGHA.1140@TK2MSFTNGP05.phx.gbl...
> 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
>
Author
10 Jul 2006 6:45 PM
Oenone
John wrote:
> 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
Author
10 Jul 2006 7:25 PM
Travis Sharpe
Oenone wrote:
> John wrote:
>> 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)
Author
10 Jul 2006 11:54 PM
Dennis
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


Show quoteHide quote
"John" wrote:

> 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
>
>
>
Author
10 Jul 2006 11:59 PM
Branco Medeiros
John wrote:
> 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.
Author
11 Jul 2006 8:53 AM
Larry Lard
John wrote:
> 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