Showing posts with label character. Show all posts
Showing posts with label character. Show all posts

Saturday, March 31, 2012

trim left 5 character.

Hi guys

I am using vb.net

I have this "12.95-ups ground" string and I need to get the string after the dash

could you send me your suggestions please.

thanks

Cemal

Hi, try this:

Dim myStrAs String ="12.95-ups ground"Dim myTrimAs String = Mid(myStr, InStr(myStr,"-") + 1)

try something like below

index=yourStringVariable.IndexOf(".");
then
YourString.Substring( check what parameter this function requires)


string _strTest = "12.95-ups ground";
Response.Write ( _strTest.Substring ( 6 ) ) ;

Thanks

-Mark post(s) as "Answer" that helped you


dim str as string

str="12.95-ups ground"

dim newVal as string

newVal=str.substring(str.indexof("-")+1)

response.write(newVal)

Trim the first character

How do i trim the first character.
I have string $22.22 and i want to be left with 22.22
I cant use subString(int,int) because i dont know the length of the stringYou can determine the length using the .Length property. So you can trim in C# like this:
string s = "$22.22";
s = s.Substring(1, s.Length - 1);
's' will now be "22.22"
There is also an overloaded substring method that only requires the starting character position:

strimmed=s.substring(1)