Collapse All Expand All | Language Filter: Visual Basic Language Filter: C#Language Filter: Visual C++Language Filter: JavaScript Visual Basic C# Visual C++ JavaScript | Example | See Also
.NET Framework Class Library
M..::Piece Method (String, String, Int32)

BMXNET 4.0 Developer API

M-like utility method to answer the piece at a 1-based offset. Corresponds to M's $$Piece function

Namespace: IndianHealthService.BMXNet
Assembly: BMXNET40 (in BMXNET40.dll)

# Syntax

| C# |  |  | Visual Basic |  |  | Visual C++ |

    public static string Piece(
    	string thePieces,
    	string aDelimiter,
    	int nthPiece
    )

    Public Shared Function Piece ( _
    	thePieces As String, _
    	aDelimiter As String, _
    	nthPiece As Integer _
    ) As String

    public:
    static String^ Piece(
    	String^ thePieces,
    	String^ aDelimiter,
    	int nthPiece
    )

#### Parameters

thePieces
  String
  Delimited input string e.g. one^two^three

aDelimiter
  String
  Delimiter character or string, commonly ~ ^ or |

nthPiece
  Int32
  The 1-based index of the piece

#### Return Value

The piece at the index, or an empty string if the index is higher than the explicit number of pieces

# Examples

Copy Code
                    String demographics="DOE,JOHN~555-55-5555~34~M";
                    int age=0;
                    if (int.TryParse(M.Piece(demographics,"~",3), out age)) {
                        System.Console.Writeln(M.Piece(demographics,"~",1)+" is "+ (age >= 18 ) ? "an adult" : "a child");
                    }

# See Also

M Class
Piece Overload
IndianHealthService.BMXNet Namespace