> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Detect URL Scheme • Rust AI Agent SDK

> detect_url_scheme: Detect URL scheme from a string. O(1) operation.

# detect\_url\_scheme

<div className="flex items-center gap-2">
  <Badge color="teal">Function</Badge>
</div>

> This function is defined in the [**parse\_utils**](../modules/parse_utils) module.

Detect URL scheme from a string. O(1) operation.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def detect_url_scheme(value: &str) -> Option<String>
```

## Parameters

<ParamField query="value" type="&str" required={true}>
  No description available.
</ParamField>

### Returns

<ResponseField name="Returns" type="Option<String>">
  The result of the operation.
</ResponseField>

## Usage

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
use praisonai::parity::parse_utils::detect_url_scheme;

assert_eq!(detect_url_scheme("postgresql://localhost/db"), Some("postgresql".to_string()));
assert_eq!(detect_url_scheme("redis://localhost:6379"), Some("redis".to_string()));
assert_eq!(detect_url_scheme("not a url"), None);
```

## Uses

* `contains`
* `find`
* `chars`
* `all`
* `is_alphanumeric`
* `to_lowercase`

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-rust/praisonai/src/parity/parse_utils.rs#L26">
  `praisonai/src/parity/parse_utils.rs` at line 26
</Card>
