# Spec CStyle String
Allows adaption of strings to C-style strings.

Extends | String
All Extended | String
All Impl'd | AssignableConcept, ContainerConcept, DestructibleConcept, ForwardContainerConcept, RandomAccessContainerConcept, ReversibleContainerConcept, SegmentableConcept, StringConcept, TextConcept
Defined in | <seqan/sequence.h>
Signature | `template <typename TValue, typename TCStyle> class String<TValue, CStyle>;`

## Template Parameters

`TValue` | The value type, that is the type of the items/characters stored in the string.Use Value to get the value type for a given class.

## Member Function Overview

### Member Functions Inherited From String

- `operator=`
- `String`

### Member Functions Inherited From AssignableConcept

- `operator=`

### Member Functions Inherited From RandomAccessContainerConcept

- `operator[]`

## Interface Function Overview

### Interface Functions Inherited From String

- `beginPosition`
- `endPosition`
- `reserve`
- `resizeSpace`
- `toCString`

### Interface Functions Inherited From AssignableConcept

- `assign`
- `set`
- `move`

### Interface Functions Inherited From ContainerConcept

- `writeValue`
- `write`
- `begin`
- `end`
- `length`
- `empty`
- `swap`
- `getObjectId`
- `moveValue`
- `append`
- `appendValue`
- `shrinkToFit`
- `directionIterator`

### Interface Functions Inherited From RandomAccessContainerConcept

- `value`
- `assignValue`
- `getValue`

### Interface Functions Inherited From SegmentableConcept

- `prefix`
- `infixWithLength`
- `infix`
- `suffix`

### Interface Functions Inherited From StringConcept

- `iter`
- `append`
- `appendValue`
- `front`
- `back`
- `resize`
- `clear`
- `erase`
- `eraseFront`
- `eraseBack`
- `capacity`
- `computeGenerousCapacity`
- `insert`
- `insertValue`
- `replace`

### Interface Functions Inherited From TextConcept

- `stringSetLimits`
- `posLocalToX`
- `posLocalize`
- `posGlobalize`
- `getSeqNo`
- `getSeqOffset`

## Interface Metafunction Overview

### Interface Metafunctions Inherited From ContainerConcept

- `DefaultGetIteratorSpec`
- `DefaultIteratorSpec`
- `Difference`
- `DirectionIterator`
- `GetValue`
- `Iterator`
- `Position`
- `Reference`
- `Size`
- `Value`

### Interface Metafunctions Inherited From SegmentableConcept

- `Infix`
- `Prefix`
- `Suffix`

### Interface Metafunctions Inherited From TextConcept

- `SAValue`
- `StringSetLimits`

## Detailed Description

Assigning a string `TValue *` to a CStyle String will not create a copy of the string but just copy pointers.

### Remarks

The purpose of this class is to access to the content of a sequence in a "zero terminated string" style. This can be useful if SeqAn classes has to be integrated in programs that use `char` arrays to store strings. Instances of `String<TValue, CStyle>` can implicitely converted to a `TValue *` that points to a zero terminated CStyle of `TValue`.

The stored c-style string object can be set by constructors or assignment. The content of a c-style string can eighter be stored in a separate buffer, that is the source string is copied. Or the buffer of the source string itself is used instead, in this case the c-style string depends on the source string and gets invalid as soon as the buffer of the source string is destroyed.

Hence, this class is a kind of adaptor from an arbitrary SeqAn string to char arrays. Of course, the opposite way is possible too.

### Examples

    // Create a string str:
    String<char> str = "this is a test string";

    // Create a c-style string object for str:
    String<char, CStyle> cStyle = str;

    // Now use cStyle as char array:
    strcmp(cStyle, "compare it to this string");

If the c-style string is needed only temporarily, the function `toCString` can be used:

    String<char> str = "this is a test string";
    strcmp(toCString(str), "compare it to this string");

#### Dox Sources

    /*!
     * @class CStyleString CStyle String
     *
     * @extends String
     *
     * @headerfile <seqan/sequence.h>
     *
     * @brief Allows adaption of strings to C-style strings.
     *
     * @signature template <typename TValue, typename TCStyle> class String<TValue,
     *            CStyle>;
     *
     * @tparam TValue The value type, that is the type of the items/characters
     *                stored in the string.Use @link Value @endlink to get the value
     *                type for a given class.
     *
     * Assigning a string <tt>TValue *</tt> to a CStyle String will not create a
     * copy of the string but just copy pointers.
     *
     * @section Remarks
     *
     * The purpose of this class is to access to the content of a sequence in a
     * "zero terminated string" style. This can be useful if SeqAn classes has to be
     * integrated in programs that use <tt>char</tt> arrays to store strings.
     * Instances of <tt>String<TValue, CStyle></tt> can implicitely converted to a
     * <tt>TValue *</tt> that points to a zero terminated CStyle of <tt>TValue</tt>.
     *
     * The stored c-style string object can be set by constructors or assignment.
     * The content of a c-style string can eighter be stored in a separate buffer,
     * that is the source string is copied. Or the buffer of the source string
     * itself is used instead, in this case the c-style string depends on the source
     * string and gets invalid as soon as the buffer of the source string is
     * destroyed.
     *
     * Hence, this class is a kind of adaptor from an arbitrary SeqAn string to char
     * arrays. Of course, the opposite way is possible too.
     *
     * @section Examples
     *
     * @code{.cpp}
     * // Create a string str:
     * String<char> str = "this is a test string";
     *
     * // Create a c-style string object for str:
     * String<char, CStyle> cStyle = str;
     *
     * // Now use cStyle as char array:
     * strcmp(cStyle, "compare it to this string");
     * @endcode
     *  If the c-style string is needed only temporarily, the function
     * <tt>toCString</tt> can be used:
     *
     * @code{.cpp}
     * String<char> str = "this is a test string";
     * strcmp(toCString(str), "compare it to this string");
     * @endcode
     */