manipulating text from form

Results 1 to 2 of 2

Thread: manipulating text from form

  1. #1
    yvidan Guest

    Default manipulating text from form

    I really hope someone can help out because I am about to lose what is left of my hair out of fraustration. <BR><BR>I am an asp programmer working with databases but the problem I am having trouble with is due to the language of my interfaces which is hebrew. <BR><BR>Hebrew is written from right to left and crossplatform programming is a lot more trickier with this language. <BR><BR>in order for IE and Netscape users be able to view text correctly, one needs to use logical hebrew . . meaning <BR><BR>if I was to write a sentence <BR>"my dog ate my homework" in hebrew it sould be <BR>"krowemoh ym eta god ym" <BR><BR>and only this way could the viewers see it correctly unless I use visual hebrew and then only IE users can view it correctly. <BR><BR>So your saying: "just get the string an reverse it" right <BR>WRONG: if I do that the sentence will reverse but the wrapping get screwed up. for expamle, If i use along line it will break from bottom to top resulting in something along these lines: <BR><BR>krowemh ym eta <BR>god ym <BR><BR>The ideal script will be able to: get a variable of n number of character in each line, break it up accordingly and then reverse the text. <BR><BR><BR>I decided to try the following solution for the task but the code is acting funny. <BR><BR><BR>-------------------------------------------------- <BR><BR>&#060;html&#062; <BR>&#060;head&#062; <BR>&#060;title&#062;alternative medicine - main page&#060;/title&#062; <BR>&#060;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-8"&#062; <BR>&#060;!-- &#060;META content="text/html; charset=windows-1255" http-equiv=Content-Type&#062; --&#062; <BR>&#060;/head&#062; <BR><BR>&#060;body&#062; <BR><BR><BR><BR><BR><BR><BR>&#060;% <BR>text = request.form("text") <BR>text = Trim(text) <BR>%&#062; <BR><BR>&#060;form action="textareatmp.asp" method="post" enctype="text"&#062; <BR>&#060;textarea cols="50" rows="20" name="text" dir="rtl"&#062;&#060;%= text %&#062; <BR>&#060;/textarea&#062; <BR>&#060;input type="submit"&#062; <BR>&#060;/form&#062; <BR><BR><BR><BR>&#060;% <BR>&#039variables used <BR>&#039text - text from text area form elemt <BR>&#039rvs_text - text string reversed <BR>&#039text_char_num - number of characters in text <BR>&#039this_text_num_chars = chars used in broken string <BR><BR>rvs_text = StrReverse(text) <BR>start_text_char_num = len(text) <BR>text_char_num = start_text_char_num <BR>max_chars_per_line = 100 <BR><BR>this_content = right(rvs_text,max_chars_per_line) <BR>last_char_in_String = left(this_content,1) <BR>this_chars_per_line = max_chars_per_line <BR>Do While last_char_in_String &#060;&#062; " " <BR>this_chars_per_line = this_chars_per_line - 1 <BR>response.write this_chars_per_line & "&nbsp;" <BR>this_content = this_content & right(this_content,this_chars_per_line) <BR>last_char_in_String = left(this_content,1) <BR>loop <BR>text_char_num = text_char_num - this_chars_per_line <BR>rvs_text = left(rvs_text,text_char_num) <BR>rvs_text_len = len(rvs_text) <BR><BR>%&#062; <BR><BR>&#060;table width="80%" border="1" align="center"&#062; <BR>&#060;tr&#062; <BR>&#060;td align="right"&#062; <BR>&#060;%= this_content %&#062; <BR>&#060;/td&#062; <BR>&#060;/tr&#062; <BR>&#060;/table&#062; <BR><BR><BR><BR>&#060;/body&#062; <BR>&#060;/html&#062; <BR><BR><BR>------------------------------------------------------- <BR>The main idea here was to: <BR>1. collect info from text area and reverse it using asp reverse function. <BR>2. try the max number of characters I allow per each line <BR>3. get the last character from this string and see if it is a space <BR>4. if it is not a space, start reducing max chars per line by 1 untill I reach a space (so that words dont get cut off in the middle) <BR>5. got a space, great, end this string, see with len how many characters it takes (should be 100 or less) <BR>6. redefine original text by calculating the original number of characters minus the characters in string by cutting former variable rvs_text by the new number of chars from the left which leaves me with original text minus the char that were taken out. <BR>7. redo process untill rvs_text is less the 100 chars <BR>8. add what is left to this_content <BR><BR>sounds confusing, well Im confused. <BR>please help me <BR><BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default A suggestion...

    You might have much better luck if you take this question to the [aspHebrew] ListServ @<BR><BR><BR>I&#039m sure there are some developers there who have had similar issues. Good luck, and happy programming!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts