need help from a programmer

Joined
Jun 8, 2013
Messages
158
Reaction score
0
Points
16
Location
Būr said,Egypt
Your Mac's Specs
MacBook Pro (i5)
how do i write Vbcrlf (It's from visual basic) at coaca?

vbcrlf put texts under each other
 

Raz0rEdge

Well-known member
Staff member
Moderator
Joined
Jul 17, 2009
Messages
15,745
Reaction score
2,071
Points
113
Location
MA
Your Mac's Specs
2022 Mac Studio M1 Max, 2023 M2 MBA
For logging using "NSLog", the newline, carriage return is added for you automatically..

The vbCrLf command basically adds a Carriage Return, and Line Feed..

What are you trying to do?
 
OP
Yodda_Hunter
Joined
Jun 8, 2013
Messages
158
Reaction score
0
Points
16
Location
Būr said,Egypt
Your Mac's Specs
MacBook Pro (i5)
i want to write"Hey" then press button then it shows,then write "What's up?" and press button,then i get this
----------
hey
what's up?
----------
 

Raz0rEdge

Well-known member
Staff member
Moderator
Joined
Jul 17, 2009
Messages
15,745
Reaction score
2,071
Points
113
Location
MA
Your Mac's Specs
2022 Mac Studio M1 Max, 2023 M2 MBA
So you are trying to do a command line program in Cocoa?
 
OP
Yodda_Hunter
Joined
Jun 8, 2013
Messages
158
Reaction score
0
Points
16
Location
Būr said,Egypt
Your Mac's Specs
MacBook Pro (i5)
i don't know what do you mean but if you know something about visual basic tell me what does VBCRLF equal in cocoa
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
A carriage return is accomplished by using \r and a line break is \n.
 
OP
Yodda_Hunter
Joined
Jun 8, 2013
Messages
158
Reaction score
0
Points
16
Location
Būr said,Egypt
Your Mac's Specs
MacBook Pro (i5)
okay i tried to write "\n" but it gave me choices on of them was Nsstring/Nstring. so it's not purely \n xD.could you write an exist code for me?
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
You put \r and \n within the confines of your string. So, a string might look like the following:
Code:
NSString *myString = @"My String\n";
That would produce:
Code:
My String
<new line>
 
OP
Yodda_Hunter
Joined
Jun 8, 2013
Messages
158
Reaction score
0
Points
16
Location
Būr said,Egypt
Your Mac's Specs
MacBook Pro (i5)
You put \r and \n within the confines of your string. So, a string might look like the following:
Code:
NSString *myString = @"My String\n";
That would produce:
Code:
My String
<new line>

thanks a lot. you helped me a lot. you are the first guy who gave me the right answer for my questions xD
 
OP
Yodda_Hunter
Joined
Jun 8, 2013
Messages
158
Reaction score
0
Points
16
Location
Būr said,Egypt
Your Mac's Specs
MacBook Pro (i5)
well,rigth now i'm stuck xD . i want to connect to commands with each other :S
i want to say ( X + _"Something" .stringvalue; so how is it?
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
Can you reword that? I'm not sure I understand what you're trying to do.
 

Raz0rEdge

Well-known member
Staff member
Moderator
Joined
Jul 17, 2009
Messages
15,745
Reaction score
2,071
Points
113
Location
MA
Your Mac's Specs
2022 Mac Studio M1 Max, 2023 M2 MBA
To concatenate two strings, you have a couple of options. One is to use to use a NSMutableString, and the other is to string with the NSString, but create a new one..

So for example..
Code:
NSString *first = @"Hello ";
NSString *second = @"World";

NSString *result = @"";
result = [result stringByAppendingString:first];
result = [result stringByAppendingString:second];

The NSString result now contains "Hello World" in it..

The second option is
Code:
NSString *second = @"World";
NSMutableString *result = @"Hello ";

result = [result appendString:first];
The NSMutableString result now contains "Hello World".

You might want to read up on Mutable and Immutable objects and see the pros and cons about using one over the other..
 
OP
Yodda_Hunter
Joined
Jun 8, 2013
Messages
158
Reaction score
0
Points
16
Location
Būr said,Egypt
Your Mac's Specs
MacBook Pro (i5)
You put \r and \n within the confines of your string. So, a string might look like the following:
Code:
NSString *myString = @"My String\n";
That would produce:
Code:
My String
<new line>

that's what i wanted but no exactly, i wanna variable instead of constants
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top