The following warnings occurred:
Warning [2] Undefined array key 0 - Line: 1677 - File: showthread.php PHP 8.2.31 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
/showthread.php 1677 errorHandler->error_callback
/showthread.php 916 buildtree




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Iterate through characters of a string?
#1
How does someone get each character of a string?

(im trying to do wordwrap for a large string)

oh I got the word wrap working now:
Code:
dim printwidth=28 Let a$="PART 1 Bruce Hall, a slightly built youth 16 years of age, fair haired and blue eyed, stood 4' 8 in shoes and despite that slight assistance still could not see over the brick wall behind which he believed stood a flying machine. At least that was what he'd overheard two delivery boys discussing outside the local butchers shop." REM pRINT a(1 to 10) dim stringpos as integer stringpos=0 dim lines as integer dim sentenceEnd as integer while stringpos<len(a) sentenceEnd=stringpos+printwidth if sentenceEnd<len(a) then FOR stringposIter=sentenceEnd TO stringpos STEP -1 if code(a(stringposIter to stringposIter))=code(" ") then print at lines,0;a(stringpos to stringposIter) stringpos=stringposIter exit for end if next end if if sentenceEnd>len(a) then print at lines,0;a(stringpos to sentenceEnd) exit while end if lines=lines+1 wend
is there an escape code for carriage return or newline?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)