C++
This presentation is the property of its rightful owner.
Sponsored Links
1 / 10

C++ PowerPoint PPT Presentation


  • 122 Views
  • Uploaded on
  • Presentation posted in: General

C++. Strings, Regular Expressions, and I/O Streaming

Download Presentation

C++

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


C

C++

  • Strings, Regular Expressions, and I/O Streaming

    • Strings are objects of one of the string classes - string, wstring, u16string or u32string. These classes behave as though they are one of the fundamental data types and offers an extremely rich set of functions making data manipulation very straight-forward. All of the types and functions for strings are contained in the <string> header file.

    • Regular Expressions is fundamentally pattern matching within strings. It is the use of wildcards and patterns to find or replace string segments. Regular expressions, then, can be used to:

      • Match some input with the expression

      • Search some input for the expression

      • Use some defined token in an expression (e.g. ‘*’)

      • Modify some input based upon the expression.


C

C++

  • I/O Streaming

    All software has some sort of I/O. C++ defines a library known as the I/O Stream Library which operates various aspects of I/O. It, like C, represents I/O as streams of data rather than some physical representation.

  • Strings

    • String types, in order to be used, must be included in source code with #include <string> : string s1 (“some string”)

    • Includes wide character strings for internationalization.

    • Typical functions consist of: assign(), length(), replace(), compare(), clear(), and erase().


  • C

    C++

    • Substrings and Concatenation

      • Substr() function

      • ‘+’ used for concatenation

    • Numeric Conversions

      • stoi

      • stol, stoll, stoul, and stoull

      • stof

      • stold

      • to_string and to_wstring


    C

    C++

    • Regular Expressions

      • Regex Match and Search Interface

        • #include <regex>

        • Similar to declaring a string: regex r1(“<pattern>”)

        • Grammar based upon the ECMAScript grammar.


    C

    C++

    Pattern Matching


    C

    C++


    C

    C++

    Assertions and Alternatives


    C

    C++


    C

    C++


    C

    C++

    • Regex Operations

      • Signature Operations

        • regex_match( … )

        • regex_search( … )

        • regex_replace( … )


  • Login