---
title: withString
framework: kernel
role: pseudoSymbol
path: kernel/ossymbol/1808192-withstring
---

# withString

Returns an OSSymbol created from an OSString, or the existing unique instance of the same value.

## Declaration

```occ
static const OSSymbol * withString(
 const OSString *aString); 
```

## Parameters

- `aString`: The OSString object to look up or copy.

## Return Value

Return Value An instance of OSSymbol representing the same characters as aString; NULL on failure.

## Overview

Overview This function creates or returns the unique OSSymbol instance representing the string value of aString. You can compare it with other OSSymbols using the == operator. OSSymbols are reference-counted normally. This function either returns a new OSSymbol with a retain count of 1, or increments the retain count of the existing instance.

## See Also

### Miscellaneous

- [free](kernel/ossymbol/1808021-free.md)
- [initWithCString](kernel/ossymbol/1808026-initwithcstring.md)
- [initWithCStringNoCopy](kernel/ossymbol/1808036-initwithcstringnocopy.md)
- [initWithString](kernel/ossymbol/1808054-initwithstring.md)
- [isEqualTo](kernel/ossymbol/1808078-isequalto.md)
- [isEqualTo(const char *)](kernel/ossymbol/1808093-isequalto.md)
- [isEqualTo(const OSSymbol *)](kernel/ossymbol/1808114-isequalto.md)
- [taggedRelease(const void *)](kernel/ossymbol/1808137-taggedrelease.md)
- [taggedRelease(const void *, const int)](kernel/ossymbol/1808154-taggedrelease.md)
- [withCString](kernel/ossymbol/1808171-withcstring.md)
- [withCStringNoCopy](kernel/ossymbol/1808179-withcstringnocopy.md)
