Hello Daniweb Community, I was wondering if there is a way to replace words from a listbox. So at the moment I've got a listbox with a couple of strings to be replaced in the textbox, however single line listbox items work but when I add a multi-lined item eg. Hello There It'll go into the listbox as HelloThere, so when I go to use the for each to replace them It doesn't work. I've tried manually replacing it by using `TextBox1.Text = TextBox1.Text.Replace("Hello" & Environment.NewLine & "There")` it'll work, and if I try For Each lbItem In .ListBox1.Items TextBox1.Text …

Member Avatar
Member Avatar
+0 forum 3

std::endl vs \n Are any particular one which should be used at specific times? I understand endl flushes the stream (although i'm not 100% what this means) while \n is simply a newline.

Member Avatar
Member Avatar
+0 forum 2

Hi everyone, Does anyone have an idea of how to skip a line in a JTextField? In System.out.println, I would normally type n but it didn't work for me when I used it in a textfield: text1.setText(**"n"**+coloumn[counter]); where the output displays well as desired excpet that it doesn't skip a line.(Forget about the actual line of code since there is a loop so multiple values are expected in a new line each). The fact is that I need to know how to skip a line. Thanks. By the way, this is the full program: import javax.swing.JFrame; import javax.swing.JOptionPane; import java.awt.event.*; …

Member Avatar
Member Avatar
+1 forum 2

I'm trying to take a file that looks like this: >taxon1 ACCGTGGATC CCTATTGATT GGATATTATC >taxon2 TTCATATGTA GGATTTCATA GATGGCCCCC And get it to look like this taxon1 ACCGTGGATCCCTATTGATTGGATATTATC I'm using a python script, so far this is what I have: #!/usr/bin/python import sys if len(sys.argv) < 2: print "usage: finalmyscript.py infile.txt" sys.exit(1) fname = sys.argv[1] handle = open(fname, "r") list = handle.readlines() for line in list: parts = line.rstrip('\n') linearr = parts.split() combine = ''.join(linearr[0]) print combine handle.close() The script removes the '\n' at the end of each line, but it still won't join the lines all on a single line. …

Member Avatar
Member Avatar
+0 forum 8

**Hi forum, I've got a question for the pros. I am making a program that has map<String, String> map = new TreeMap<String, String>(); and a Scanner to read a file contains some data which is assigned to map.put(); method. The data is something like this: UK USA Canada Australia etc. The country names are separated with a "tab". All the data is on one line of a text file. I just want that when I print the country names and when system prints the data up to 5 tabs it will start a new line and then print the other …

Member Avatar
Member Avatar
+0 forum 6

Hello Everyone..!! I am beginner at PHP. I would like to have solution for "\n" in textfile php. $file = "testFile.txt"; $fh = fopen($file, 'a+') or die("can't open file"); $firstname = $_POST["prenom"]; $lastname = $_POST["nom"]; $mood = $_POST["humeur"]; $datestring = date("d/m/y "); $timestring = date("H.i.s"); $data = "$firstname ; $lastname ; $mood ; $datestring : $timestring "\n" "; fwrite($fh, $data); fclose($fh); Actual Result: testprenom ; testnom ; bonne ; 19/10/12 : 11.09.23 ; ; ; 19/10/12 : 11.09.25 Expected Result: testprenom ; testnom ; bonne ; 19/10/12 : 11.09.23 Thanks a lot for your time in advanced.

Member Avatar
Member Avatar
+0 forum 13

int main(void) { char faceValue[2]; char suitValue[2]; //User enters the value of their hole cards. setCardFaceValue(faceValue); setCardSuitValue(suitValue); for(int i=0;i<2;i++) printf("Element %i: %c %c\n",i,faceValue[i],suitValue[i]); return 0; } void setCardFaceValue(char* face) { char card[2][20] = {"left card:","right card:"}; for(int i=0;i<2;i++) { printf("Enter face value for "); for(int x=0;x<19;x++) { printf("%c",card[i][x]); if(card[i][x] == ':') { fgets(&face[i],3,stdin); } } } } void setCardSuitValue(char* suit) { char card[2][20] = {"left card:","right card:"}; for(int i=0;i<2;i++) { printf("Enter suit value for "); for(int x=0;x<19;x++) { printf("%c",card[i][x]); if(card[i][x] == ':') { fgets(&suit[i],3,stdin); } } } } Here is the output: [Click Here](http://gyazo.com/6fe495527ffdb35a7ba066c26be24bac) The value entered for the first …

Member Avatar
Member Avatar
+0 forum 5

Hi, I have a form which saves a string of text to a database with rawurlencode() which adds things like space characters (%20) and newline characters (%0D%0A), however, when I use rawurldecode() on this string it only decodes the space characters, and ignores all the newlines, by simply printing them also as spaces. If there's another way to ensure new paragraph lines are printed correctly I'm all ears but I've spent the last hour or two asking/googling and have found no workable solution, I've also played around with str_replace() and nl2br() to no avail.

Member Avatar
Member Avatar
+1 forum 5

I've read many threads on how to remove a new line character '\n' using fgets()-- however, how would one go about removing a new line character simply by using getchar() ?

Member Avatar
Member Avatar
+0 forum 11

This is homework. I have to write a bash shell script using awk to process three delimited text files and produce a formatted report. The three files are as follows: [CODE]GRADES file John Bunyan:90:100:75:60 Maria Montessori:80:90:60:82 Alice Cooper:75:80:54:47 Harvey Mudd:89:45:89:95 PROJECTS file test1:30 test2:30 paper2:20 exam:50 LEVELS file A:89.5 B:79.5 C:69.5 D:59.5 F:0[/CODE] I hope this is fairly easy to see how these relate. The object is to go through each student, weight their grades, and output the corresponding letter grade. The awk script I have so far looks like it should work, but I am getting numerous errors, mostly …

Member Avatar
Member Avatar
+0 forum 2

Hello there, Currently doing some work for my coursework. I've noticed the "\n" is obviously the new line function or whatever you guys call it, but would you understand what I mean when I say it creates too much of a new line? For example, I want the newline to do this: ***** ***** Instead, in my coding it's producing this: ***** ***** If I'm missing something I'll be very grateful if somebody could point it out! Thank you!

Member Avatar
Member Avatar
+0 forum 10

Hi, i'm trying to implement a print function and i can print a single string out but i'm having trouble configuring the page setup properly, mainly moving to a new line when the margin of the page is reached and moving to a new lines for each string in a list of string. so far i have this printing out a single piece of text: [CODE]private void document_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { System.Drawing.Font printFont = new System.Drawing.Font ("Arial", 28, System.Drawing.FontStyle.Regular); string text = "Now then"; // Draw the content. e.Graphics.DrawString(text.ToString(), printFont, System.Drawing.Brushes.Black, 10, 10); }[/CODE] i've tried looking on the …

Member Avatar
Member Avatar
+0 forum 3

I wrote a program to analyze a log file for a machine that my company repairs. The program that runs the machine spits output into a text file (.log) and my program will analyze it and return the results of different calculations to the user. The log file idealy looks like this most of the time [CODE] >25 233966 300156 89980 >26 232342 300157 90010 >25 235908 300156 90020 >22 242106 300154 90000[/CODE] This is ideal formatting and USUALLY is the case. Now out of each of those 4 line "paragraphs" only the first and the last lines (eg >22 …

Member Avatar
Member Avatar
+0 forum 5

I'm having a problem with IE, while it works in FF: the var doesn't save any \n aka enter. I have the following code: [code] <script type="text/javascript"> function addu() { var message = window.prompt("Enter the text that needs to be underlined below"); if (message != "" && message != "null") { document.editform.text.innerHTML += "\[u\]" + message + "\[/u\]"; } } </script> <img src="beheerimages/ubutton.jpg" onClick="addu()" /><br /> <form name='editform'> <textarea class="editarea" name="text" cols="100" rows="20"><?php echo $row['bbtext']; ?></textarea> </form> [/code] Does anyone know a answer to this question? As soon as a user presses the ubutton.jpg image, the enters are deleted. ~G …

Member Avatar
Member Avatar
-1 forum 2

The End.