Given a string in Java, just take the first X letters -


is there c# substring java? i'm creating mobile application blackberry device , due screen constraints can afford show 13 letters plus 3 dots ellipsis.

any suggestion on how accomplish this?

i need bare bones java , not fancy trick because doubt mobile device has access complete framework. @ least in experience working java me year ago.

you can want string.substring().

string str = "please truncate me after 13 characters!"; if (str.length() > 16)     str = str.substring(0, 13) + "..." 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -