View Full Version : help with the code
GoOgLe
03-23-2007, 01:09 PM
how can i change a latter in input object ???
Rizlauk has the same function in his bbcoder project...
RizlaUK
03-23-2007, 01:25 PM
if you are doing what i think you are trying to do (convert the bbcode to html) then do something like this for each tag
strText = Input.GetText("inp_main");
strText = String.Replace(strText, "{B}", "<B>", false);
strText = String.Replace(strText, "{/B}", "</B>", false);
--add more tags here
--and close out with this
strText = String.Replace(strText, "[", "<", false);
strText = String.Replace(strText, "]", ">", false);
Input.SetText("inp_main", strText);
but rather than setting the text in the input like this, id send it to a html file (Text.Witefromstring) in temp folder and view it in a browser object
EDIT, for the string replace tool, i just used some thing like this: (put in button on click?)
strText = Input.GetText("inp_main");
Old = Input.GetText("inp_old");
New = Input.GetText("inp_new");
String.Replace(strText, Old, New, false);
GoOgLe
03-23-2007, 01:30 PM
no i want to do what u have in ur bbcoder project:
2 inputs (1 input for latter or a word u want to change and for to change it to) and 1 progress button
RizlaUK
03-23-2007, 01:31 PM
also, it would help others when searching the forum if you titled your posts with the problem you are having rather than "help with code" every time :yes
EDIT:
see above
GoOgLe,
If I may make a suggestion. When you post, make the title of the post indicative of what your asking rather than broadening the topic with a "Need Help" type of title. People are apt to skip over a post when the title/subject isn't something they feel they can help on. You could be missing out on some really good answers.
I've not been deputized by IR as the forum police, so this isn't by any means a forum rule per se. Just a couple years of expience of hanging out on this forum trying to offer what little I can.
Edit: @ RizlaUK.. In stereo, only I'm the echo. Ya beat me to it.
GoOgLe
03-23-2007, 01:39 PM
ok i will do that next time sorry for that
the code didnt work for me... i put the code button on click...
strText = Input.GetText("Input1");
Old = Input.GetText("Input2");
New = Input.GetText("Input3");
String.Replace(strText, Old, New, false);
I don't think its appropriate for someone with less than 3,500 posts to be telling others what to do in this forum... :p
I'll contact Intrigued and have him post it then. Until then, its merely a "suggestion" :lol
RizlaUK
03-23-2007, 01:46 PM
lol worm, fastest poster in the west.......Draw.....lmao
Google, i remember having some troubles with that function, if i remember rightly i had to add a space either to the end or the begining of the edited string
like
String.Replace(strText, Old.." ", New.." ", false);
or
String.Replace(strText, " "..Old, " "..New, false);
give it a try and see what happens, i cant realy remember exactly what i did in the end but i know i added a space somewhere else it wouldent work
GoOgLe
03-23-2007, 01:49 PM
String.Replace(strText, Old.." ", New.." ", false);
or
String.Replace(strText, " "..Old, " "..New, false);
both didnt work Rizlauk !!!!
RizlaUK
03-23-2007, 01:59 PM
lol, soz, i forgot a line of code
try this
strText = Input.GetText("Input1");
Old = Input.GetText("Input2");
New = Input.GetText("Input3");
strText = String.Replace(strText, Old, New, true);
Input.SetText("Input1", strText);
EDIT: BTW, this will change every instance of the word enterd, i am working on a function to search for one word at a time, when i got it working i'll share it wuth you
GoOgLe
03-23-2007, 02:05 PM
thats perfect Rizlauk
thanks alot
EDIT: BTW, this will change every instance of the word enterd, i am working on a function to search for one word at a time, when i got it working i'll share it wuth you
i will b waiting for that
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.