Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

REPLACE 5

Posted on 2004-10-27
3
Medium Priority
?
153 Views
Last Modified: 2010-04-15
Hi Experts,

I need to replace all occurances of hyphen and space BETWEEN CHARACTERS (not digits) ONLY within text string with nothing.
example:    ABC- EFH     becomes ABCEFH

Thank you.
0
Comment
Question by:fpoyavo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 18

Expert Comment

by:armoghan
ID: 12431142
you mean something like tihs

string str = "ABC- EFH- XYZ";
Console.WriteLine(str.Replace(" ","").Replace ("-",""));
0
 
LVL 7

Accepted Solution

by:
God_Ares earned 2000 total points
ID: 12432439
                 //using System.Text.RegularExpressions;

                  Regex r= new Regex(@"-\s*");
                  MessageBox.Show( r.Replace("abd- asd") );

when you need

abc      -     def

to be adcdef  replace Regex r= new Regex(@"-\s*"); with Regex r= new Regex(@"\s*-\s*");


now it will do : abc      def


just giving you options
0
 
LVL 18

Expert Comment

by:armoghan
ID: 12440919
fpoyavo .. What was wrong with my answer?
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question