I'm not very good with jargon string manipulation, and I was wondering how you would like to have a string without cutting I can go about minimizing a word. I know how to use substrings, but there is no index or nothing really is good.
Say I have the following string:
text = "This is a long string that I can not display" I have to trim it by 10 characters, but if it does not end with any space, terminate the term. I do not want the string variable to look like this:
"This is a long string that I can not do"
I want to end it The word happens until there is no place.
If I understand correctly, then you want to shorten the string for a certain length
If this is the case, then you can try.
Something like the following: Quick brown jumps on "; // Replace with your string Var maxLength = 6 // Trim the string for the maximum number of characters / maximum length to extract var trimmedString = yourString.substr (0, maxLength); // Trim again if we are in the middle of a word trimmedString = trimmedString.substr (0, Math.Man (Trimed string.length, trimedstilation.lindindex ("")))
Comments
Post a Comment