i have requirement whihc have set limit on length of string.
if length excedes limit want truncate string. doing datatable , adding string datacolumns.
i think work...
mystr = mystr.length > maxlen ? mystr.substring(0, maxlen) : mystr;
depending on code looks like; might need make sure mystr isn't null before evaluate line. but, if mystr longer max length, gets truncated; otherwise mystr.
mystr.length fail if mystr null.
this done strings added datatable.
if want truncate strings in datatable, might misunderstanding question. can set .maxlength property on datacolumn, believe not truncate data.
Comments
Post a Comment