473,394 Members | 1,829 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

String manipulation

Very simple questions,
I have some data of strings, say, str1,sting2,stringstring3,etc
I also have a text file that needs to be filled upat some empty places,
I need to do this in javascript, could you help me with some apis that
can do this ? I am completely new to javascript. any help is appreciated.
Oct 26 '06 #1
12 2562
Andy McNamara wrote on 27 okt 2006 in comp.lang.javascript:
Very simple questions,
Not for me, see below, Andy.
I have some data of strings, say, str1,sting2,stringstring3,etc
What is/are "data of strings"?

Are "str1, sting2, stringstring3" names of string [sting?] variables?
I also have a text file that needs to be filled upat some empty places,
How can a text file have empty places?

A textfile being/containing a string of characters.
I need to do this in javascript,
Why do you need to do that in javascript?
could you help me with some apis that
What are apis?
can do this ?
Do what?
I am completely new to javascript. any help is appreciated.
We all were at some point in time.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Oct 26 '06 #2
ASM
Andy McNamara a écrit :
Very simple questions,
I have some data of strings, say, str1,sting2,stringstring3,etc
I also have a text file that needs to be filled upat some empty places,
I need to do this in javascript, could you help me with some apis that
can do this ? I am completely new to javascript. any help is appreciated.
JavaScript can't write in a file.

You'l have to ask that to PHP for instance.

(eventually using XMLHttpRequest javascript function)
Oct 26 '06 #3
ASM wrote on 26 okt 2006 in comp.lang.javascript:
Andy McNamara a écrit :
>Very simple questions,
I have some data of strings, say, str1,sting2,stringstring3,etc
I also have a text file that needs to be filled upat some empty
places, I need to do this in javascript, could you help me with some
apis that can do this ? I am completely new to javascript. any help
is appreciated.

JavaScript can't write in a file.
You'l have to ask that to PHP for instance.
Javascript can write a file just as well as php,
both as serverside code.

Javascript can use Scripting.FileSystemObject

Javascript in wscript or cscript can too.
(eventually using XMLHttpRequest javascript function)
Eventually? Oh, as part of Ajax?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Oct 26 '06 #4
ASM
Evertjan. a écrit :
>
Javascript can write a file just as well as php,
both as serverside code.

Javascript can use Scripting.FileSystemObject
can you give me an example ?

Oct 26 '06 #5
ASM wrote on 26 okt 2006 in comp.lang.javascript:
Evertjan. a écrit :
>>
Javascript can write a file just as well as php,
both as serverside code.

Javascript can use Scripting.FileSystemObject

can you give me an example ?
Under classic ASP:

<script language='jscript' runat='server'>

var fso, tf;
fso = new ActiveXObject('Scripting.FileSystemObject');
tf = fso.CreateTextFile(Server.MapPath('/myDir/myfile.txt'), true);

// Write a line with a newline character.
tf.WriteLine('Testing 1, 2, 3.') ;

// Write three newline characters to the file.
tf.WriteBlankLines(3) ;

// Write a text.
tf.Write ('This is a test.');
tf.Close();

</script>

not tested

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Oct 26 '06 #6
ASM
Evertjan. a écrit :
ASM wrote on 26 okt 2006 in comp.lang.javascript:
>Evertjan. a écrit :
>>Javascript can write a file just as well as php,
both as serverside code.

Javascript can use Scripting.FileSystemObject
can you give me an example ?

Under classic ASP:
would that work in my FireFox ?

I undersdand it is server-side script.

If it is :
- would that work in my Apache ?
- if not what javascript script could I use
(with an example it is better for my poor mind)

MapPath() is a generic function ? (to say : localhost)
<script language='jscript' runat='server'>

var fso, tf;
fso = new ActiveXObject('Scripting.FileSystemObject');
tf = fso.CreateTextFile(Server.MapPath('/myDir/myfile.txt'), true);

// Write a line with a newline character.
tf.WriteLine('Testing 1, 2, 3.') ;

// Write three newline characters to the file.
tf.WriteBlankLines(3) ;

// Write a text.
tf.Write ('This is a test.');
tf.Close();

</script>

not tested
Oct 26 '06 #7
ASM wrote on 26 okt 2006 in comp.lang.javascript:
Evertjan. a écrit :
>ASM wrote on 26 okt 2006 in comp.lang.javascript:
>>Evertjan. a écrit :
Javascript can write a file just as well as php,
both as serverside code.

Javascript can use Scripting.FileSystemObject
can you give me an example ?

Under classic ASP:
Read up about ASP.
>
would that work in my FireFox ?

I undersdand it is server-side script.

If it is :
- would that work in my Apache ?
- if not what javascript script could I use
(with an example it is better for my poor mind)

MapPath() is a generic function ? (to say : localhost)
><script language='jscript' runat='server'>

var fso, tf;
fso = new ActiveXObject('Scripting.FileSystemObject');
tf = fso.CreateTextFile(Server.MapPath('/myDir/myfile.txt'), true);

// Write a line with a newline character.
tf.WriteLine('Testing 1, 2, 3.') ;

// Write three newline characters to the file.
tf.WriteBlankLines(3) ;

// Write a text.
tf.Write ('This is a test.');
tf.Close();

</script>

not tested



--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Oct 26 '06 #8
ASM
Evertjan. a écrit :
ASM wrote on 26 okt 2006 in comp.lang.javascript:
>Evertjan. a écrit :
>>ASM wrote on 26 okt 2006 in comp.lang.javascript:

Evertjan. a écrit :
Javascript can write a file just as well as php,
both as serverside code.
>
Javascript can use Scripting.FileSystemObject
can you give me an example ?
Under classic ASP:

Read up about ASP.
thank you.
Oct 26 '06 #9
ASM said the following on 10/26/2006 4:12 PM:
Andy McNamara a écrit :
>Very simple questions,
I have some data of strings, say, str1,sting2,stringstring3,etc
I also have a text file that needs to be filled upat some empty places,
I need to do this in javascript, could you help me with some apis that
can do this ? I am completely new to javascript. any help is appreciated.

JavaScript can't write in a file.
FSO in IE can!

JScript in ASP can.

Perhaps you meant "Javascript in a default security environment on a web
page can't write a file on the local hard drive".

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Oct 26 '06 #10
In message <45***********************@news.orange.fr>, Thu, 26 Oct 2006
22:12:05, ASM <st*********************@wanadoo.fr.invalidwrite s
>Andy McNamara a écrit :
>Very simple questions,
I have some data of strings, say, str1,sting2,stringstring3,etc
I also have a text file that needs to be filled upat some empty places,
I need to do this in javascript, could you help me with some apis
that can do this ? I am completely new to javascript. any help is
appreciated.

JavaScript can't write in a file.

You'l have to ask that to PHP for instance.

(eventually using XMLHttpRequest javascript function)
<FAQENTRY>, somewhere around 2.2 - I suggest a short section/paragraph
along the general lines of :

Javascript is a general term covering very similar languages used in
differing environments, including client-side Web (the default
assumption in c.l.j), server-side Web (on-topic in c.l.j), and Windows
programming (CScript, WScript, for which news:microsoft.* is preferred).
(any other environments?)
It's a good idea to read the newsgroup and its FAQ. See below.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
<URL:http://www.jibbering.com/faq/>? JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Oct 27 '06 #11
Hi,

ASM wrote:
Evertjan. a écrit :
>ASM wrote on 26 okt 2006 in comp.lang.javascript:
>>Evertjan. a écrit :
ASM wrote on 26 okt 2006 in comp.lang.javascript:

Evertjan. a écrit :
>Javascript can write a file just as well as php,
>both as serverside code.
>>
>Javascript can use Scripting.FileSystemObject
can you give me an example ?
Under classic ASP:

Read up about ASP.

thank you.
Actually, forget ASP and read about ASP.NET ;-)

Just kidding. It's true that using JavaScript on ASP to program both the
client and the server was kind of neat. But I wouldn't go back from .NET.

About saving files: Client-side JavaScript running in a browser can do
that too, but it needs the right permissions.

See this
http://www.galasoft-lb.ch/myjavascri...rer/index.html

This feature allows, for example, to write HTA (HTML Applications)
running in IE but having the same permissions as a standalone
application. Think of it as having the ease of a VBA application, but
without having to touch VB (yuk).

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Oct 28 '06 #12
ASM
Laurent Bugnion a écrit :
Hi,
Salut,
See this
http://www.galasoft-lb.ch/myjavascri...rer/index.html
I've been
I'll look at home (locally)
This feature allows, for example, to write HTA (HTML Applications)
running in IE but having the same permissions as a standalone
application. Think of it as having the ease of a VBA application, but
without having to touch VB (yuk).
Unlovely, on my Mac I use any M$ possibilities,
(vb vba vscript hta htc are not for me and anyway of no use)
I'm not more advanced
(et avec Apache sur mon Mac de quoi je dispose?)
HTH,
that could :-)

Stephane
Oct 28 '06 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Dim | last post by:
I found that C# has some buggy ways to process string across methods. I have a class with on global string var and a method where i add / remove from this string Consider it a buffer... with some...
32
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
29
by: zoro | last post by:
Hi, I am new to C#, coming from Delphi. In Delphi, I am using a 3rd party string handling library that includes some very useful string functions, in particular I'm interested in BEFORE (return...
4
by: WaterWalk | last post by:
Hello, I'm currently learning string manipulation. I'm curious about what is the favored way for string manipulation in C, expecially when strings contain non-ASCII characters. For example, if...
10
by: micklee74 | last post by:
hi if i have a some lines like this a ) "here is first string" b ) "here is string2" c ) "here is string3" When i specify i only want to print the lines that contains "string" ie the first...
5
by: Niyazi | last post by:
Hi, Does anyone knows any good code for string manipulation similar to RegularExpresion? I might get a value as string in a different format. Example: 20/02/2006 or 20,02,2006 or ...
3
by: crprajan | last post by:
String Manipulation: Given a string like “This is a string”, I want to remove all single characters( alphabets and numerals) like (a, b, 1, 2, .. ) . So the output of the string will be “This is...
7
Frinavale
by: Frinavale | last post by:
I currently have a .NET application that has an object which passes a string (a connection string) as a parameter to another object that does database manipulation. This string isn't stored...
3
by: frankeljw | last post by:
I have 2 Java strings 1st String is a series of names, colons, and numbers ie) Name1:13:Name2:4526:Name3:789:Name4:3729:Name5:6:Name6:44 2nd String is a name ie) Name2 I need to get the...
22
by: mann_mathann | last post by:
can anyone tell me a solution: i cannot use the features in standard c++ string classgh i included the string.h file but still its not working.
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.