1 Replies - 181 Views - Last Post: 13 October 2017 - 06:26 AM

#1 ggwp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 13-October 17

add whitespaces between numbers(odds)

Posted 13 October 2017 - 01:51 AM

var express = require('express');
var path = require('path');
var app = express();
var request = require('request');
var cheerio = require('cheerio');
var fs = require('fs');
var port = 8080;
var url = "https//..."

request(url, function(err,resp,body){
	var $ = cheerio.load(body);
	var odd = $('.rate');
	var oddText = odd.text();
	console.log(oddText);
})
app.listen(port);
console.log('Server running on '+ port); 



I scraped odds from HTML and I need to add white spaces between them.
This is how it looks now.
1.533.555.312.053.252.931.059.5518.511.224.4511.601.12619.38
This is what i'm trying to do
1.53 3.55 5.32
2.05 3.25 2.93
1.05 9.55 18.51
1.22 4.45 11.60
1.12 6 19.38
I searched a lot but found nothing, please help me.

Is This A Good Question/Topic? 0
  • +

Replies To: add whitespaces between numbers(odds)

#2 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3714
  • Posts: 13,467
  • Joined: 08-August 08

Re: add whitespaces between numbers(odds)

Posted 13 October 2017 - 06:26 AM

It looks like that is being done in odd.text();, which you haven't shown us.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1