Search code examples
javacsszk

How to word wrap a label's content on a specified character in ZKOSS


I have a zk Label that has Value:-1,2,3,4,21,211,4321,656,1233,678,342 and due to this it does not wrap well so i tried

detailval.setStyle("word-wrap:break-word;");

which breaks it fine but i need to break it on a comma i.e. my text gets wrapped like this.

1,2,3,4,21,211,4321,656,1233,67
8,342

instead of

1,2,3,4,21,211,4321,656,1233,
678,342

Is there a way i can specify that the label gets wrapped only on one specific character.Thanks


Solution

  • The css property word-wrap:break-word; consider that a word is anything between two spaces, in your string you don't have any of them -1,2,3,4,21,211,4321,656,1233,678,342, that's why it splits that string in that way you don't want, I suggest just to put a space after every comma, that will resolve your problem

    -1,2,3,4,21,211,4321,656,1233,678,342,