For strings being placed into the database, you can use the Mid() function to get only a certain portion of a string. And you could use a series of if greater than (>) or less than (<) statements to limit the size of a number in a If elseif statement.
If you’re not doing some client side data validation the real challenge you have is, “What to do with the left overs”. For example, this string is being placed into a field but I only want the first 10 characters:
<b>Now is the time for all men to come to the aid of their fellow countrymen.</b>
Which, of course, becomes:
<b>Now is the</b>
But what do you do with this part:
<b> time for all men to come to the aid of their fellow countrymen.</b>