How to replace the last comma with an empty string in ASP
For example Aaa,bbb,ccc,eee, this string
How to make the last comma change no, the other does not change AH
Question added: For example aaa,bbb,ccc,eee, this string
How to make the last comma change no, the other does not change AH
If it's aaa,bbb,ccc,eee, it doesn't change.
<%
str= "aaa,bbb,ccc,eee,"
if Right (str,1) = "," Then
str=left (Str,len (str)-1) End
if
The ASP right function returns a specified number of characters from the right-hand side of the string.
Tip: To determine the number of characters in the string argument, use the Len function
Tip: You can also refer to the lower left function
Grammar
Right (String,length)
Parameter description
String
Required option. A string expression whose rightmost character is returned.
Length
Required option. Numeric expression that indicates the number of characters to return. Returns a 0-length string if 0, or the entire string if the number is greater than or equal to the number of all characters in the string argument.
Instance 1
Dim txttxt= "This is a beautiful day!"
Response.Write (Right (txt,11))
Instance 2
Dim txttxt= "This is a beautiful day!"
Response.Write (Right (txt,100))
Instance 3
Dim txt,xtxt= "This is a beautiful day!" X=len (TXT)
Response.Write (Right (TXT,X))