Results 1 to 7 of 7

Thread: Conversion

  1. #1
    Join Date
    Jun 2012
    Location
    THE Students-City of Holland
    Posts
    332
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default Conversion

    How to make this:
    Code:
    SELECT%20name%20FROM%20items%20WHERE%20id%20=%201
    from this:
    Code:
    SELECT name FROM items WHERE id = 1
    How to convert spaces to %20? I need this for connecting with my database because else it won't work.

  2. #2
    Join Date
    Jan 2009
    Location
    Turlock/LA, California
    Posts
    1,494
    Mentioned
    3 Post(s)
    Quoted
    66 Post(s)

    Default

    ctrl+r -> add a space char to the first textbox -> add %20 to second text box -> replace all

  3. #3
    Join Date
    Jun 2012
    Location
    THE Students-City of Holland
    Posts
    332
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Quote Originally Posted by x[Warrior]x3500 View Post
    ctrl+r -> add a space char to the first textbox -> add %20 to second text box -> replace all
    that's not what I mean lol
    I mean how to do it in a function, because I don't want the script look so messy.

  4. #4
    Join Date
    Jan 2009
    Location
    Turlock/LA, California
    Posts
    1,494
    Mentioned
    3 Post(s)
    Quoted
    66 Post(s)

    Default

    get a string of whatever you will send to your database, and before you send it, use the replace(); function (or replaceWrap(); )

  5. #5
    Join Date
    Jun 2012
    Location
    THE Students-City of Holland
    Posts
    332
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Can you please give an example, I try it but I don't understand the last thing you have to put in....


    Simba Code:
    program New;
      {$i SRL\SRL.simba} // includes all main functions


    var
      Q,R : string;
      F : TReplaceFlags;

    begin

      SetupSRL; // essential function to make bots work

      Q := 'Test Test Test Test';


      //R := Replace(Q,' ','20',F);
      R := ReplaceWrap(Q,' ','%20',F);

      writeln(R);

    end.

    it only replaces it once... :S

  6. #6
    Join Date
    Jan 2009
    Location
    Turlock/LA, California
    Posts
    1,494
    Mentioned
    3 Post(s)
    Quoted
    66 Post(s)

    Default

    Simba Code:
    program new;
    {$I SRL/SRL.simba}
    var
      Q,R,D : string;
      F : TReplaceFlags;

    begin
      setupsrl;

      Q := 'Test Test Test Test';

      D := ReplaceWrap(Q,' ','%20',F);
      while(D<>R)do
      begin
        R:= D;
        D := ReplaceWrap(D,' ','%20',F);
      end;

      writeln(R);
    end.

  7. #7
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    No need for all that.

    Simba Code:
    ReplaceRegExpr('%20', 'SELECT%20name%20FROM%20items%20WHERE%20id%20=%201', ' ', True)

    I'll finish my RegEx tutorial eventually. 20 Lines turns into 1.
    I am Ggzz..
    Hackintosher

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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