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

silverlight - Applying a style to ItemContainerStyle in C# -

c# - NullReferenceException in MySqlClient.NativeDriver -

php - Updating recent updates - Problem in procedure - Any other approach? -