How can i display text as form of line by line in textView? - ios4

all
textViewObj.text=#"updated My interests,updated Basics,registration
updated My partner should be..."
How can add the above information as form o line by line in textview?
Please help me.
Thank you in advance.

Separate each line using the newline character, which is
#"\\n"
in Cocoa. Notice the double backslash
textViewObj.text=#"updated My interests \\n updated Basics \\n registration updated My partner should be..."
If you have too many commas to replace, do this
NSString *stringSeparatedByNewLine = [stringWithCommas stringByReplacingOccurrencesOfString:#"," withString:#"\\n"];
textViewObj.text=stringSeparatedByNewLine;

Related

How to find in lines \n\t and replace them with \t? (Python)

In a csv-file ([tab] stands for a tabulation) :
R456
R457
[tab]trutz
R457
[tab]trutz
R458
Z32
[tab]frot
My wished output :
R456
R457[tab]trutz
R457[tab]trutz
R458
Z32[tab]frot
So, it is about replacing \n\t with \t. But a line.replace('\n\t','\t') does not work.
Thanks in advance.
Use str. rstrip() to remove a trailing newline.
This will remove the newline but will keep the tab.

Remove delimiter ↵ when reading text in matlab

I use:
file_name='file_name.txt';
fid=fopen(file_name);
line=fgets(fid);
How can I remove an enter sign, ↵ , that I sometimes get in line?
Thank you
There is no such thing as an "enter sign", but there are newline characters (depending on the platform: LF, CR, or CR+LF).
You can read the contents of a line without the trailing newline characters e.g. using fgetl.
Use fgetl(fid) instead of fgets(fid).

How to remove blank line in Sakura editor?

I need to prepare test data having around 10K lines with many blank lines, same has to be removed. Earlier I was using editplus (Text editor) and could able to solve very easily by using Find (Find text: "\n\n" Regular expression) and Replace (empty) option.
Here in this project I am using Sakura editor and tried the below option to remove blank lines but its not working.
Need to remove line 6 and 7.
Find text
\n\n
\r\n\r\n
[\r\n]+[\r\n]
More information about using of regular expression in sakura editor
Click here
PS: I have some restriction in my current project to download and install any other software/tools.
Any help is appreciated.
Finally found solution. Like to share with others.
In sakura editor, we can remove the empty lines by using find and replace option.
Find ^\r\n 【Option:Regular expression】 and replace
Explanation
^ Beginning of the line
\r carriage-return character
\n newline (line feed) character

Formatting text when going through a file

I'm going through each line of a text file which stores a list of names and trying to format each name in the following way:
for name in open(r'C:\names.txt', 'r'):
print('Name: ',name, 'Email: ',email)
This prints 'Name: Rita' and 'Email: test#text.com' on separate lines instead of the same line apart from the last line of the file which prints correctly. I've tried adding end="" after the print but this prints the Email before the Name as it's aligning the wrong lines such as 'Email: test#test.comName: Hannah'
How can I properly align each variable and print to the same line?
Thanks.
Try:
for name in open(r'C:\names.txt', 'r'):
print('Name: ', name.rstrip(), 'Email: ',email)
The issue is that, in python, the line that you read from a file includes the trailing newline character. Printing name thus prints a newline character and hence starts a newline. To avoid that, remove the trailing newline. The method rstrip() is one way to do that. It will also remove other trailing whitespace but that is usually a virtue, not a fault.

How to use backspace escape sequence in Notepad++?

I need to use find new lines (\n) in a .txt file and replace them with a backspace (\b). Using this in the Find and Replace feature of Notepad++ successfully finds the new lines, (\n), but replaces them with the characters "\b" instead of applying a backspace. How can this be done correctly?
\r\n should work.
replace them with empty field and you will get your backspace(\b) equivalent
A simple way would be Ctrl + J or Edit->Line Operations->Join Lines
I was also trying to replace \n with backspace, but the above solutions seems neat. Maybe it helps someone.
(I tried the \r\n solution and it seems both works the same way :) )
In notepad++,
Go to Edit menu, line operations and then click on "Remove Empty Lines"
You get what you are trying with regular expression.
Removing empty lines
Use regular expressions, in Find what:, enter \r\n and in Replace with: leave that blank.

Resources