# string
[utilities]

## Typedefs
typedef struct axutil_string | axutil_string_t
## Functions
AXIS2_EXTERN axutil_string_t * | axutil_string_create (const axutil_env_t *env, const axis2_char_t *str)
AXIS2_EXTERN axutil_string_t * | axutil_string_create_assume_ownership (const axutil_env_t *env, axis2_char_t **str)
AXIS2_EXTERN axutil_string_t * | axutil_string_create_const (const axutil_env_t *env, axis2_char_t **str)
AXIS2_EXTERN void | axutil_string_free (struct axutil_string *string, const axutil_env_t *env)
AXIS2_EXTERN axis2_bool_t | axutil_string_equals (const struct axutil_string *string, const axutil_env_t *env, const struct axutil_string *string1)
AXIS2_EXTERN struct axutil_string * | axutil_string_clone (struct axutil_string *string, const axutil_env_t *env)
AXIS2_EXTERN const axis2_char_t * | axutil_string_get_buffer (const struct axutil_string *string, const axutil_env_t *env)
AXIS2_EXTERN unsigned int | axutil_string_get_length (const struct axutil_string *string, const axutil_env_t *env)

## Detailed Description

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

## Function Documentation

AXIS2_EXTERN struct axutil_string* axutil_string_clone | ( | struct axutil_string * | string,
|  | const axutil_env_t * | env |
| ) |  |  | `[read]`

Clones a given string. Does not duplicate the buffer, rather increments the reference count. Each call to clone needs to have a matching free, when the clone is done with.

Parameters:

  | string | pointer to string struct
  | env | pointer to environment struct

Returns:
  pointer to cloned string struct instance

AXIS2_EXTERN axutil_string_t* axutil_string_create | ( | const axutil_env_t * | env,
|  | const axis2_char_t * | str |
| ) |  |  |

Creates a string struct.

Parameters:

  | str | pointer to string. string struct would create a duplicate of this
  | env | pointer to environment struct

Returns:
  a pointer to newly created string struct

AXIS2_EXTERN axutil_string_t* axutil_string_create_assume_ownership | ( | const axutil_env_t * | env,
|  | axis2_char_t ** | str |
| ) |  |  |

Creates a string struct.

Parameters:

  | str | pointer to string. string struct would not create a duplicate of this, but would assume ownership
  | env | pointer to environment struct

Returns:
  a pointer to newly created string struct

AXIS2_EXTERN axutil_string_t* axutil_string_create_const | ( | const axutil_env_t * | env,
|  | axis2_char_t ** | str |
| ) |  |  |

Creates a string struct.

Parameters:

  | str | pointer to string. string struct would not create a duplicate of this and assumes the str would have longer life than that of itself
  | env | pointer to environment struct

Returns:
  a pointer to newly created string struct

AXIS2_EXTERN axis2_bool_t axutil_string_equals | ( | const struct axutil_string * | string,
|  | const axutil_env_t * | env,
|  | const struct axutil_string * | string1 |
| ) |  |  |

Compares two strings. Checks if the two strings point to the same buffer. Do not cmpare the buffer contents.

Parameters:

  | string | pointer to string struct
  | env | pointer to environment struct
  | string1 | pointer to string struct to be compared

Returns:
  AXIS2_TRUE if string equals string1, AXIS2_FALSE otherwise

AXIS2_EXTERN void axutil_string_free | ( | struct axutil_string * | string,
|  | const axutil_env_t * | env |
| ) |  |  |

Frees string struct.

Parameters:

  | string | pointer to string struct
  | env | pointer to environment struct

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN const axis2_char_t* axutil_string_get_buffer | ( | const struct axutil_string * | string,
|  | const axutil_env_t * | env |
| ) |  |  |

Gets string buffer.

Parameters:

  | string | pointer to string struct
  | env | pointer to environment struct

Returns:
  pointer to string buffer

AXIS2_EXTERN unsigned int axutil_string_get_length | ( | const struct axutil_string * | string,
|  | const axutil_env_t * | env |
| ) |  |  |

Gets string length. *

Parameters:

  | string | pointer to string struct *
  | env | pointer to environment struct *

Returns:
  buffer length