![]() ![]() ![]() While ($getanswers = mysql_fetch_array($result)) ( ). $result = mysql_query($sql, $connection) ĭie("Database query failed: ". How can I do this? Seems like it should be easy but can't figure it out. But I need to trim() each item in the array. Apparently, the trim() function is only removing space from the beggining and end of the ENTIRE string. The only difference is the fact that there are spaces in the Orlando Magic stuff. Using this code below, the answer IS found if $userinput is any of the Miami Heat options, but it is NOT found if it's any of the Orlando Magic options. I then look for the user entered answer ($userinput, which has trim and strtolower run on it) in the array. I run this code to bring back the answers data (all acceptable answers) in an array. *Notice how sometimes there are leading or ending spaces (i.e there is a space before "magic" but NOT a space before "miami"). I have a bunch of answers in a MySQL database in the form of. I think I found the cause, but need help fixing it. php remove non numeric delete everything except the number in the text in php trim comma from variable in php php remove nbsp from string php remove characters not numbers or letters php remove all but numbers create array from string with commas php php remove last character from string if comma convert comma separated number to number. I'm able to maniupulate them as Strings everywhere else in the code. The only thing I can guess is that for some reason the contents of the DB aren't being seen as Strings, even though they are, in fact, Strings. But it seems to me like the Trim command is supposed to exist to make it so that I don't have to do that. Am I supposed to sacrifice a goat first or something?īTW, if I go in and edit the database manually, I can strip out the spaces by hand, and everything works fine. It's simply NOT removing the white space, despite the fact that the entire description of what "Trim" does consists of "removes white space." It boggles my mind. I also tried (as per another tutorial example) setting a second variable trimming it, and using the second variable in the Echo, like so: I'm extremely OCD, and so if code doesn't work the way the documentation states, I freeze. Things like this make me want to pound spikes into my eyes, because there's just no logical way for me to work though this. Obviously, I'm leaving out a ton of code, but the important part is that it's not stripping the white space. So to assign a paragraph style: first run the find/change to apply the style, and then run it again with the Change Format blank, so that it removes the hard-coded numbers and spaces.I'm using the following code to attempt to strip white space from my search results: If both Change To and Change Format are blank then it deletes the text. (You may need to click More Options to see that.) However, if you assign formatting here, then InDesign will not delete the text it finds! It’s kind of tricky… if there is formatting specified and the Change To field is blank, then it applies that styling and leaves the text. If you want to assign a paragraph style to each paragraph it finds, then use the Change Format field at the bottom of the dialog box. Then, leave the Change to field blank (so that it actually deletes whatever it finds). You can open Find/Change, select the GREP tab, and type this into the Find what field: ^\d ?\.\s Fortunately, it’s very easy with a quick GREP find/change: To clean it up, I need to remove that second set of numbers - the “hard coded” ones that are actually typed in the text - and the extra spaces that follow. The result (with Type > Show Hidden Characters turned on) is this: One of the most annoying things is dealing with a long list of numbered paragraphs, because I need to strip off the manual numbers and replace them with automatic paragraph numbers.įor example, I just grabbed this text from Thad McIlroy’s wonderful Future of Publishing site, pasted it into an InDesign text frame and applied automatic numbering to it. I often need to format material that someone has sent in a text file, or from text copied from a web page.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |