How to know if string contains more than one same word

user3924730

I have a string which is like this ..String s=and oc='LOCAL' and oc='STD' and oc='ISD' and oc='INC'.Now as per my requirement if this string contains more than one and then i have to replace all other and with or except first and else it should be the same string only..

Please help me how to get to know about more than one and and how to replace all other and except first one.

I am trying to get this using replace but i am not getting it exactly..

Please help me..

Noctis

Doesn't sound like you've put much effort in, but here are 2 options:

  1. Use string.IndexOf to get the index of your first and, and from there, cut the rest, and then use string.Replace to change and to or
  2. Use linq. Split on white space. You can then have a list of words, and then you can replace all the ands that aren't the first to or.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Java: check if string contains more than one character

분류에서Dev

How to give a ruby class more than one of same attribute

분류에서Dev

How to use jquery 'append' to add div after an 'focus'ed input, if there are more than one input with same class?

분류에서Dev

How to split the terminal into more than one "view"?

분류에서Dev

How to check whether a given word contains in String?

분류에서Dev

How to get string if length is more than 50?

분류에서Dev

How to make one name refer to more than one picturebox?

분류에서Dev

Find if string contains word

분류에서Dev

Find the number of files that contains specific attributes assigned to more than one element

분류에서Dev

Android - How to make buttons listen more than one time

분류에서Dev

How to connect more than one monitor to Windows 7

분류에서Dev

How to count the elements in array which are more than one (php)

분류에서Dev

How to create ico file with more than one image

분류에서Dev

How to get more than one value of text box using in condition

분류에서Dev

How to redirect more than one text file in c programm

분류에서Dev

How do you start more than one thread in C++

분류에서Dev

how to query sar(sysstat) for more than one day data points

분류에서Dev

Regular expression to capture repeated word (more than one 2 repetition in text)

분류에서Dev

More than one Intent ExtraText?

분류에서Dev

More than one Navigation controller

분류에서Dev

More than one writes to file

분류에서Dev

Fetch more than one column

분류에서Dev

How to combine 2 functions when one takes more than one argument?

분류에서Dev

How to locate one or more underlying disks when you know only a directory?

분류에서Dev

prevent the same request done more than once

분류에서Dev

prevent the same request done more than once

분류에서Dev

Same user added more than once in Database

분류에서Dev

Link one model more than once

분류에서Dev

pthread for processes with more than one parameter

Related 관련 기사

  1. 1

    Java: check if string contains more than one character

  2. 2

    How to give a ruby class more than one of same attribute

  3. 3

    How to use jquery 'append' to add div after an 'focus'ed input, if there are more than one input with same class?

  4. 4

    How to split the terminal into more than one "view"?

  5. 5

    How to check whether a given word contains in String?

  6. 6

    How to get string if length is more than 50?

  7. 7

    How to make one name refer to more than one picturebox?

  8. 8

    Find if string contains word

  9. 9

    Find the number of files that contains specific attributes assigned to more than one element

  10. 10

    Android - How to make buttons listen more than one time

  11. 11

    How to connect more than one monitor to Windows 7

  12. 12

    How to count the elements in array which are more than one (php)

  13. 13

    How to create ico file with more than one image

  14. 14

    How to get more than one value of text box using in condition

  15. 15

    How to redirect more than one text file in c programm

  16. 16

    How do you start more than one thread in C++

  17. 17

    how to query sar(sysstat) for more than one day data points

  18. 18

    Regular expression to capture repeated word (more than one 2 repetition in text)

  19. 19

    More than one Intent ExtraText?

  20. 20

    More than one Navigation controller

  21. 21

    More than one writes to file

  22. 22

    Fetch more than one column

  23. 23

    How to combine 2 functions when one takes more than one argument?

  24. 24

    How to locate one or more underlying disks when you know only a directory?

  25. 25

    prevent the same request done more than once

  26. 26

    prevent the same request done more than once

  27. 27

    Same user added more than once in Database

  28. 28

    Link one model more than once

  29. 29

    pthread for processes with more than one parameter

뜨겁다태그

보관