![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Jan 2006
Location: Texas
Posts: 36
Rep Power: 0
![]() |
If x=y, then go here...
this is a stupid question, i know....
If i say.. if x==y... i want to set y a side, so i can also keep on saying... if x==a if x==b if x==c.... i want to set them all aside in a side in a list, then after it is done, i want it to display a, b, c, y, etc.... how would i do that? |
|
|
|
|
|
#2 |
|
Programmer
Join Date: Sep 2005
Location: GA
Posts: 99
Rep Power: 4
![]() |
i don't understand your question
|
|
|
|
|
|
#3 |
|
Programmer
Join Date: Jan 2006
Location: Texas
Posts: 36
Rep Power: 0
![]() |
ok... i was afraid i didnt word it properly....
ok so i have some random letters... atcgatcatcatc and acatatcgagacatc (for example, the ones i will be using are much longer) i know this isnt the most efficient way, but i want to say like x(1)=atcg x(2)=catc y=acat a=catc z=atcg and i want to say... (x meens x(1) or x(2)) if x=y, then set y aside... if x does not = y, then ignore if x=a, then set a aside... if x does not = a, then ignore if x=z, then set z aside... if x does not = z, then ignore in this case, the program will have set a and z aside because a(catc)=x(2) and z(atag)=x(1)... and y would be ignored becuase it =s neither x(1) or x(2)... now i want it to go to a new page and display in a list all of the things it set aside.... so it would display Both contained: atag catc i hope you understood that.... sorry for the confusion |
|
|
|
|
|
#4 |
|
Professional Programmer
|
I still dont understand
__________________
Forgiveness is the fragrance that the violet sheds on the heal that has crushed it. - Mark Twain Destruction leads to a very rough road, but it also breeds creation. |
|
|
|
|
|
#5 |
|
Battle Programmer
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 763
Rep Power: 3
![]() |
So you just want to parse some long strings and look for certain shorter substrings, while recording any strings that match the search string? And in your example, are y, a, and z each a possible random string that could be of arbitrary length?
Maybe more to the point, do you have any code? |
|
|
|
|
|
#6 |
|
Programmer
Join Date: Sep 2005
Location: GA
Posts: 99
Rep Power: 4
![]() |
I think he want to split the text, since he did something like this
str = atcgatcatcatc str.split('at') |
|
|
|
|
|
#7 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Frankly, if you can't express yourself clearly to a human, how do you expect to express yourself clearly to your machine? It's a lot less able to draw inferences. All of your respondents are trying to read your mind, and that doesn't work really, really well. Think out your problem, precisely what you want and need to do, and try to formulate it in programming language terms. "i want to set them all aside in a side in a list." Say that out loud to yourself and see if you "get it."
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#8 |
|
Newbie
Join Date: Feb 2006
Posts: 11
Rep Power: 0
![]() |
Do you mean something like this?
if( x == y && x == a && x == b && x == c )
{
// ...
}
__________________
Canonical Books: The best programming books around. |
|
|
|
|
|
#9 |
|
Programmer
Join Date: Nov 2005
Location: Turkey
Posts: 93
Rep Power: 3
![]() |
you can use switch-case loop....
switch( ) { case ? : ............... break; case ? : ............... break; case ? :............... break; } |
|
|
|
|
|
#10 | |
|
Expert Programmer
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4
![]() |
Quote:
|
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|