Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Tokenize / Removing characters (https://forums.graalonline.com/forums/showthread.php?t=73075)

Rapidwolve 03-26-2007 02:32 AM

Tokenize / Removing characters
 
I want to save a string with saveLines(), when I use tokenize("\n"); to remove the '\n' all it does is escape it ('\\n'); How do I get rid of the '\n' all together to make an array?

killerogue 03-26-2007 02:46 AM

Err, what? O.o

xXziroXx 03-26-2007 04:53 AM

Post the code?

Angel_Light 03-26-2007 06:00 AM

\n makes a line break in the code... just add a new line if your saving to some file

godofwarares 03-26-2007 08:22 PM

Quote:

Originally Posted by Rapidwolve (Post 1293092)
I want to save a string with saveLines(), when I use tokenize("\n"); to remove the '\n' all it does is escape it ('\\n'); How do I get rid of the '\n' all together to make an array?

PHP Code:

tokens = var.tokenize("\\n"); 

That should work, Try it.

Rapidwolve 03-26-2007 08:43 PM

Quote:

Originally Posted by Angel_Light (Post 1293148)
\n makes a line break in the code... just add a new line if your saving to some file

Oh really? I didn't know that I just randomly decided to put '\n' in the text parser -_-
just kidding, yes i know

Quote:

Originally Posted by godofwarares (Post 1293317)
PHP Code:

tokens = var.tokenize("\\n"); 

That should work, Try it.

Seems like it should, I'll try

Edit, now its taking away all N's along with the \n's and when I do \\\n it works but it adds an n to the beggining of each array but the first one

Inverness 03-30-2007 11:37 PM

Well if all else fails you could make a parser yourself.
I've never encountered this problem so I can't really help much, sorry.
PHP Code:

public function replaceSubstring(stringpositionlengthnewstring) {
  
temp.stringa;
  
temp.stringb;
  
temp.outstring;
  
  if (
position 0) {
    return;
  }
  
stringa string.substring(0position);
  
stringb string.substring(position length, -1);
  
outstring stringa newstring stringb;
  return 
outstring;


You can find instances of "\\n" with a function and edit them out with that function I posted if you wish.


All times are GMT +2. The time now is 04:21 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.