www.webdeveloper.com
Results 1 to 5 of 5

Thread: Removing text with jQuery (Hard? or Simple?) Example within..

  1. #1
    Join Date
    May 2010
    Posts
    43

    Removing text with jQuery (Hard? or Simple?) Example within..

    I have got a php page that grabs specific cell data from my google spreadsheet.

    The problem is that google decides to echo back the cell data in the worst way possible.

    If I request C8 I get string(2) "23" as a response instead of just 23.

    This happens 25~ times depending on how many cells I request - how can I use jQuery to remove ALL cases of string(2) or string(whatever) and perhaps the quotes as well.

    Right now I'm stuck with garbage like <p class="cellone">string(2) "43"</p>

    I'm looking to turn them all into <p class="cellone">43</p> etc.

    Is there a relatively simple way to remove all this garbage string related text?

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Code:
    s = 'string(2) "43"';
    alert(s.replace(/string\(\d+\) "(\d+)"/, "$1"));

  3. #3
    Join Date
    May 2010
    Posts
    43
    Can always count on the Borg , I'll give that a shot today. Much appreciated.

  4. #4
    Join Date
    May 2010
    Posts
    43
    I'm generating the cell results as part of a function like so (php inside of my jquery-based page)

    else{
    $gDoc->getSpreadFeed($_GET['WS']);
    $gDoc->setWorkSheet(1);
    echo "<p class=\"cellone\">Label: ";
    var_dump($gDoc->getCell('AA48'));
    echo "</p>";

    etc, if I wanted to do this on all results what am I missing? Your idea makes sense but how would I define this query as a variable to be able to perform that kind of a string replace?

    Sorry for the noobyness, I assure you in ten years I'll be much better
    Last edited by Sodascript; 10-06-2010 at 09:54 AM.

  5. #5
    Join Date
    May 2010
    Posts
    43
    All problems solved, lesson learned. Thanks again Fang.

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
  •  
HTML5 Development Center



Recent Articles