Answer the question
In order to leave comments, you need to log in
How to truncate a string from the end in C#?
There is a code:
byte[] ba = Encoding.Default.GetBytes(s);
var hexString = BitConverter.ToString(ba);
hexString = hexString.Replace("-", "");
string pattern = @"[A-Z]";
string target = "";
Regex regex = new Regex(pattern);
string result = regex.Replace(hexString, target);
return result;
Answer the question
In order to leave comments, you need to log in
string str = "Hello Marco !";
if (str.Length > 8)
str = str.Substring(0, str.Length - (str.Length - 8));
Remove(Int32) upd in your case, just specify the starting position for removal (8)
since string is an immutable class, Remove is also a function that returns a value in which something was removed
ps
stackoweflow- nope, in this case right away MSDN ;)))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question