Why not just adjust based upon the actual width of the screen, rather than guess?
CSS media queries are your best friend here.
Do these message not have spaces upon which the string will naturally break without all the brouhaha you are planning on going through?
You want to break the string to adjust to screen width, correct?
If that's the case, why does mobile versus not make one bit of difference?
Should you not just be focusing on the available width rather than the device type?
What are your plans to determine screen width? What's the algorithm you plan to use to determine where to insert breaks?
What are these long unbroken strings in the first place?
So what do you want to do? What is your plan to fit the 5 kilos of marbles in the 1-kilo bag?
you need to figure out how to break up strings, or apply styles appropriate to how you want to responsively display the data on smaller screens.