Re: clean up code (sorry for being stupid)
Re: clean up code (sorry for being stupid)
- Subject: Re: clean up code (sorry for being stupid)
- From: email@hidden (Farl)
- Date: Wed, 22 Aug 2001 01:52:31 -0700
well going with Ondra's wise words (as I have come to trust him so far),
forget the .h part (altho i would love some more info from Ondra as to
if there are any reasons besides the readability to not include them in
the header file.)
so here is some more specific stuff...
say part of your code (As you want) is to take a string, and then return
the string with some extra part added (I am using this example cos i
know the code and dont have to dig into the idiot docs).
//////// Original Code:
NSString *someString, *otherString;
someString = @"This is the basic string\n";
someString = [someString stringByAddingString:@"This is a second line to
it\n"];
someString = [someString stringByAddingString:@"This is a third line to
it\n"];
otherString = @"This is the other string that we will add to\n";
someString = [someString stringByAddingString:@"This is a second line to
it\n"];
someString = [someString stringByAddingString:@"This is a third line to
it\n"];
//then you do whatever it is you want to do with these strings.
////////// New Code:
{
NSString *someString, *otherString;
someString = @"This is the basic string\n";
otherString = @"This is the other string that we will add to\n";
[someString makeStringThreeLines];
[someString makeStringThreeLines];
}
This is the function:
-(NSString)MakeStringThreeLines:(NSString *)aString
{
aString = [aString stringByAddingString:@"This is a second line to
it\n"];
aString = [aString stringByAddingString:@"This is a third line to
it\n"];
return aString;
};
////// this should work (i think) hehe... i am too lazy to write an
empty project to test it.
So if you have more questions, let me know.
Searle
email@hidden
www.sketchwork.com
IMPORTANT: This email is intended for the use of the individual addressee(s) named above and may contain information that is confidential, privileged or unsuitable for overly sensitive persons with low self-esteem, no sense of humour or irrational religious beliefs. If you are not the intended recipient, any dissemination, distribution or copying of this email is not authorised (either explicitly or implicitly) and constitutes an irritating social faux pas. Unless the word absquatulation has been used in its correct context somewhere other than in this warning, it does not have any legal or no grammatical use and may be ignored. No animals were harmed in the transmission of this email, although the kelpie next door is living on borrowed time, let me tell you. Those of you with an overwhelming fear of the unknown will be gratified to learn that there is no hidden message revealed by reading this warning backwards, so just ignore that Alert Notice from Microsoft. However, by !
pouring a complete circle of salt around yourself and your computer you can ensure that no harm befalls you and your pets. If you have received this email in error, please add some nutmeg and egg whites, whisk and place in a warm oven for 40 minutes.