Advertisement
Guest User

Untitled

a guest
Sep 13th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. stock WordWrap(givenString[128])
  2. {
  3. new temporalString[ 128 ];
  4. memcpy(temporalString, givenString, 0, 128 * 4);
  5.  
  6. new comaPosition = strfind(temporalString, ",", true, 0),
  7. dotPosition = strfind(temporalString, ".", true, 0);
  8. while(comaPosition != -1)
  9. {
  10. if(temporalString[comaPosition+1] != ' ') strins(temporalString, " ", comaPosition + 1);
  11. comaPosition = strfind(temporalString, ",", true, comaPosition + 1);
  12. }
  13. while(dotPosition != -1)
  14. {
  15. if(temporalString[dotPosition+1] != ' ') strins(temporalString, " ", dotPosition + 1);
  16. dotPosition = strfind(temporalString, ",", true, dotPosition + 1);
  17. }
  18.  
  19. new spaceCounter = 0,
  20. spacePosition = strfind(temporalString, " ", true, 0);
  21.  
  22. while(spacePosition != -1)
  23. {
  24. spaceCounter++;
  25. if(spaceCounter % 4 == 0 && spaceCounter != 0)
  26. {
  27. strins(temporalString, "\n", spacePosition + 1);
  28. }
  29. spacePosition = strfind(temporalString, " ", true, spacePosition + 1);
  30. }
  31. return temporalString;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement