You can truncate strings with a printf field-width specifier:
printf
printf(\"%.5s\", \"abcdefgh\"); > abcde
Unfortunately it does no
Why not from the left? the only difference is to use simple division:
printf("%2d", 1234/100); // you get 12