Browse Blog Posts by Tags

Showing related tags and posts for the Blogs application. See all tags in the site
  • Working with strings: bits and pieces

    In the previous post I showed how to generate the parent OUs by splitting and rejoining a string. I used the operators –split and –join These were introduced in PowerShell v2.  In PowerShell v1 we had to use the split() method and stitch the thing back together ourselves using string concatenation...
    Posted to Richard Siddaway's Blog by RichardSiddaway on Tue, Jul 12 2011
    Filed under: Filed under: ,
  • Working with strings: I’m a substitute

    PowerShell string substitution is a very neat trick PS (1) > $string = "World" PS (2) > "Hello $string" Hello World   We can substitute the value of the variable into the string. The catch – it only works with double quoted strings i.e. we use “” If we use single quotes...
    Posted to Richard Siddaway's Blog by RichardSiddaway on Sun, Jul 10 2011
    Filed under: Filed under: ,
  • Working with strings: likes and dislikes

    Lets start with a string $str = "abcdefghi" We often only have part of a string to work with so we end up using –like $str -like "abc*" $str -like "*abc*" $str -like "*def*" $str -like "*ghi"   these all return True   As you might expect $str...
    Posted to Richard Siddaway's Blog by RichardSiddaway on Sun, Jul 10 2011
    Filed under: Filed under: ,
  • Working with Strings: Simple comparisons

    Lets start with simple string matching as its a task that frequently comes along "aaa" -eq "aaa" "aaa" -ceq "aaa"   both return true.  What’s –ceq you ask? PowerShell by design is case insensitive so for most operations it treats “aaa” and “AAA” identically...
    Posted to Richard Siddaway's Blog by RichardSiddaway on Sat, Jul 9 2011
    Filed under: Filed under:
  • Conversion between Unicode UTF-8 and UTF-16 with STL strings

    Suppose there is a need to convert between Unicode UTF-8 and Unicode UTF-16 in a Windows C++ application. This can happen because it is good to use UTF-16 as the Unicode encoding inside a C++ app (in fact, UTF-16 is the encoding used by Win32 Unicode APIs), and use UTF-8 outside app boundaries (e.g....
    Posted to C++ and more! by Gdicanio on Fri, Feb 4 2011
    Filed under: Filed under: , , ,
  • Building Double-NUL-Terminated Strings

    There was an interesting post on Raymond Chen's blog about double-null-terminated strings. Double-NUL-terminated strings have some pros, like reducing heap fragmentation and offering good locality: in fact, the strings are allocated in memory sequentially, and not scattered around. Another benefit...
    Posted to C++ and more! by Gdicanio on Fri, Apr 9 2010
    Filed under: Filed under: ,
  • STL strings: loading from resources

    As we've already seen , while it is possible to load CString's from resources out of the box , std::string and std::wstring classes do not offer this feature. Carefully reading the MSDN documentation for LoadString Win32 API, an interesting point about nBufferMax parameter can be found: If this...
    Posted to C++ and more! by Gdicanio on Tue, Jan 5 2010
    Filed under: Filed under: ,
  • STL strings are not zero-terminated

    In a previous blog post, I listed some advantages (IMHO) of using CString instead of std::string class. There is another subtle (but important!) point which turns the scales in CString 's favour: in fact, CString is a C++ class that wraps zero-terminated strings (i.e. the good old C strings), instead...
    Posted to C++ and more! by Gdicanio on Mon, Jan 4 2010
    Filed under: Filed under: ,
  • CString or std::string - that is the question

    ...with apologies to Shakespeare So, should we use CString or std::string class to store and manage strings in our C++ code? Well, if there is a need of writing portable C++ code, the choice should be std::string , which is part of the C++ standard library. But, in the context of C++ Win32 programming...
    Posted to C++ and more! by Gdicanio on Mon, Jan 4 2010
    Filed under: Filed under: ,
  • Optimizing String Concatenation in VBA

    Good day, This probably should have been my first blog entry, as my code structures often look at using buffers when dealing with dynamic Arrays and Strings. Today we will have a brief look at Strings. When building a String you want to avoid a large number of concatenations, especially in a potentially...
    Posted to Nate Oliver's blog by Nate Oliver on Sat, May 23 2009
    Filed under: Filed under: , ,
Page 1 of 1 (10 items)