String/paragraph splitter

  def StringSplit(strLine, intLen):      splix = strLine.split(" ")      lines = []     line = ""      for i in range(len(splix)):          if (len(line)+len(splix[i]) > intLen):              lines += [line]              line = splix[i]+" "                       else:              line += splix[i]+" "          if(i == len(splix)-1):              lines += [line]       return lines  
You can feed this function a long string, and the length of characters you want each new string to be. It will split the paragraph along the spaces and reassemble a list of strings, each no longer than the length you specify. This is great for processing text to be displayed in-game. Just give each text object an index number to display and increase the number each time the player clicks a button. You can get it here or in BaySik (which I am working on alongside another project).  https://code.google.com/p/baysik-pk-modules/    It's annoying that the buttons to add links and wrap code tags are missing. (soylent buttons are made out of javascripts!)

I tried three times to fix the code, you are on your own.

Think you’re going for this?


def StringSplit(strLine, intLen):
    splix = strLine.split(" ")      
    lines = []     
    line = ""      
    for i in range(len(splix)):          
        if (len(line)+len(splix[i]) > intLen):              
            lines += [line]              
            line = splix[i]+" "                       
        else:              
            line += splix[i]+" "    
        
        if(i == len(splix)-1):              
            lines += [line]       
        
    return lines

Thanks, I don’t know what is wrong. If I can find a good image and youtube downloader for chrome, I’ll jump to that. Firefox is being ie, and all other browsers are lacking.