c# remove last character from string
string Name = "Teste,"
string ReturnName = "";
ReturnName = Name.Remove(Name.Length - 1);
c# remove last character from string
string Name = "Teste,"
string ReturnName = "";
ReturnName = Name.Remove(Name.Length - 1);
remove last character from string c#
myString = myString.Substring(0, myString.Length-1);
stringBuilder delete last character
public class StringBuilderRemoveLastCharacterExample {
public static void main(String[] args) {
//creates an empty StringBuilder object
StringBuilder sbld = new StringBuilder();
int[] numbers = {1, 2, 3, 4, 5};
for(int number : numbers){
sbld.append(number).append(",");
}
System.out.println("StringBuilder contains: " + sbld);
/*
* To remove last character from StringBuilder, use
* the deleteCharAt method
*/
//always make sure to check the length to avoid exception
if( sbld.length() > 0 )
sbld.deleteCharAt( sbld.length() - 1 );
System.out.println("StringBuilder contains: " + sbld);
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us