English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

3 answers

You can access the last character in a string by treating the string as an array, eg:
lastChar = str[str.Length-1];

To remove it you can use substring to return all but the last character, eg:
str2 = str.Substring(0, str.Length-1);

2006-12-08 22:08:29 · answer #1 · answered by Biff 3 · 0 0

just get the string length then set the length - 1 to 0.

length = strlen(string)
string[length - 1] = 0

2006-12-09 00:51:41 · answer #2 · answered by justme 7 · 0 0

int k=strlen(str) //where str is ur original string

for ( int i = 0 ; i {
str1[i]=str[i];
}

// where str1 is some new string name, where your previous string will be saved without the last character

your new string str1 will have all your string data without the last character.

2006-12-08 23:28:25 · answer #3 · answered by Sergeant_Vomit 2 · 0 0

fedest.com, questions and answers