CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: substr

  1. #1
    Join Date
    Apr 2001
    Posts
    36

    substr

    Please reply to this question. Previous one went to home email address. I'm at work.

    Is there a substr equivelent in VB. I use it in perl. I want to be able to extra "pm" in a date variable


  2. #2
    Join Date
    Aug 2000
    Location
    England
    Posts
    185

    Re: substr

    use the Mid function


  3. #3
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: substr

    Have a look also at instr function. It will help you find what you want inside a string (to give correct parameter to Mid function when you do not know exactly how is written a string)


    Special thanks to Lothar "the Great" Haensler. Come back soon, you Guru.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  4. #4
    Join Date
    Oct 2005
    Posts
    19

    Question substr

    Is there a substr equivelent in Visual c++ (mfc)? thanks.

  5. #5
    Join Date
    Oct 2005
    Location
    The Netherlands
    Posts
    10

    Re: substr

    You can make your own function, 'cause I don't think there's a good function...

    Something like this I guess?

    Code:
    char* subStrng(char* const chrOrig, int begin, int size)
    {	
    	char *chrNew = new char[size];
    	
    	for (int i=0; i<size; i++) {
    		chrNew[i] = chrOrig[i+begin];
    	}
    	
    	return chrNew;
    }
    Edit;
    I think CString has a mid-function... maybe you can use that;
    http://msdn.microsoft.com/library/de...g.3a3a.mid.asp

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured