05-08-2004, 07:11 PM
okay i have a question on file output how would i filter somthing out like if it hade "a" in it then remove it from a file
filtering files
|
05-08-2004, 07:11 PM
okay i have a question on file output how would i filter somthing out like if it hade "a" in it then remove it from a file
05-08-2004, 08:10 PM
INSTR([start,]stringexpression1,stringexpression2)
_ stringexpression1 is the string to be searched _ stringexpression2 is the string to look for _ If the optional start argument is used to begin the search beyond the first character of stringexpression1, it must be a numeric-expression with an integer value between 1 and 32,767. it searches a string for another string. after that you need to use some logic to remove it try using LEFT$ and RIGHT$ and LEN
05-08-2004, 09:15 PM
MID$ might also come in handy.
I'd knock on wood, but my desk is particle board.
05-09-2004, 03:28 AM
sure :roll:
i made a filter function that doesn't use MID =P
05-09-2004, 06:59 AM
MID$ ???
could you elobrate
05-09-2004, 08:00 AM
Quote:okay i have a question on file output how would i filter somthing out like if it hade "a" in it then remove it from a file Do you mean that the file's name has an "a" in it (as in "happy.txt")? Or do you mean that the data you are writing to the file has an "a" in it (for example, you are saying PRINT #1, s$ and you want to know if s$ has the character "a" within it)? If you just want to find the letter "a" and replace it within a string (which will work for either case above), you can use the MID$ statement (not the function!) as such: Code: s$ = "happy joy joy whee yay" If you want to do something more complicated such as totally removing the letter "a", you would probably be better off building up an entirely new string and using the MID$ function to iterate over each character in the original string and adding only the acceptable characters to the new string, like this: Code: s$ = "happy joy joy whee yay"
05-09-2004, 09:23 PM
DrV: yup but your example doesn't work with strings longer then one letter long. this works (though it's a function =P)
Code: FUNCTION filter$ (text$, look$)
05-09-2004, 09:31 PM
Sum crazy code:
Code: FILES *.*
05-09-2004, 09:37 PM
a$ = MID$(b$, start%, end%)
a$ is the string expression in b$, starting @ start%, and continuing end% spaces String$ = "This is an example" a$ = MID$(String$, 5, 4) a$ = "is a"
05-09-2004, 09:40 PM
my crazy code. seaches an entire file for a word and removes all traces.
Code: DECLARE FUNCTION filter$ (text$, look$) |
« Next Oldest | Next Newest »
|