remove quotation marks from a parsed string

I am working on a texture packer .json file reader (I’ve been meaning to, and it came up in a question so I have finally started!), and the method I use in my .fnt file reader is not working in this project.

The difference is that in the font file, words are not surrounded by quotation marks “” , however the texture packer file does. How do I go about removing or reading between the quotation marks in my script?

function GetTextureInfo() 
{
    var _tempInfo : String[] = textureAtlasInfo.text.Split("

"[0]);
var _tmp : String;

    for (var input : String in _tempInfo)
    {
       var _words : String[] = input.Split(" "[0]);
 
       for (var _word : String in _words)
       {
          var _words_split : String[] = _word.Split(":"[0]);
 
          for (var _word1 : String in _words_split)
          {
             Debug.Log( "_word1 " + _word1 );
 
             if ( String.Equals( _word1, "frame" ) )
             {
                Debug.Log("!! **  FOUND WORD => frame ** !!");
 
                _tmp = _words_split[1].Substring( 0, _words_split[1].Length ); 
 
                Debug.Log( "_tmp " + _tmp );
             }
          }
      }
   }

EDIT : this won’t compile, but shows what kind of text I’m trying to break down :

var myParsedString : String = "{

    "background.png":
    {
    "frame": {"x":2,"y":2,"w":480,"h":320},
    "rotated": false,
    "trimmed": false,
    "spriteSourceSize": {"x":0,"y":0,"w":480,"h":320},
    "sourceSize": {"w":480,"h":320}
    },
    "label.png":
    {
    "frame": {"x":2,"y":324,"w":202,"h":27},
    "rotated": false,
    "trimmed": false,
    "spriteSourceSize": {"x":0,"y":0,"w":202,"h":27},
    "sourceSize": {"w":202,"h":27}
    }}";

function Start() 
{
    var _tempInfo : String[] = myParsedString.Split("

"[0]);
var _tmp : String;

    for (var input : String in _tempInfo)
    {
        var _words : String[] = input.Split(" "[0]);

        for (var _word : String in _words)
        {
            var _words_split : String[] = _word.Split(":"[0]);

            for (var _word1 : String in _words_split)
            {
                Debug.Log( "_word1 " + _word1 );

                _word1 = _word1.Replace("\"", "");

                Debug.Log( "_word1 " + _word1 );

                if ( String.Equals( _word1, "frame" ) )
                {
                    Debug.Log("!! **  FOUND WORD => frame ** !!");
                }

            }
        }
    }
}

EDIT 2 : as at _word1 = _word1.Replace(“"”, “”);

I’ve uploaded my full current script to compare/check : http://www.alucardj.net16.net/unityquestions/TexturePackerParser.js

and the text file : http://www.alucardj.net16.net/unityquestions/sampleText.js (its .js 'cos my host doesn’t seem to like .txt )

If you can grab the parameter you need:

   var newString = "theParameter";
   var index =newString.Length;
   newString = newString.Remove(0,1);
   newString = newString.Remove(index-1,1);

The first parameter of Remove is the index in the string we want to point and the second parameter is how many characters are to be removed.
(I reckon -1 because Length is the null).

To be tried as I cannot but I guess that could help you.

Did you try, String.Trim("\"".ToCharArray()); I was able to remove all the double quotes with this.

sorry if i am not getting the question.