string_split


Description:

public static void string_split (string string, out string out_cnc_params, out string out_provider, out string out_username, out string out_password)

Extract the provider, connection parameters, username and password from string.

in string, the various parts are strings which are expected to be encoded using an RFC 1738 compliant encoding. If they are specified, the returned provider, username and password strings are correctly decoded.

For example all the following connection strings: <programlisting><![CDATA[ PostgreSQL://meme:pass@DB_NAME=mydb;HOST=server PostgreSQL://meme@DB_NAME=mydb;HOST=server;PASSWORD=pass PostgreSQL://meme@DB_NAME=mydb;PASSWORD=pass;HOST=server PostgreSQL://meme@PASSWORD=pass;DB_NAME=mydb;HOST=server PostgreSQL://DB_NAME=mydb;HOST=server;USERNAME=meme;PASSWORD=pass PostgreSQL://DB_NAME=mydb;HOST=server;PASSWORD=pass;USERNAME=meme PostgreSQL://DB_NAME=mydb;USERNAME=meme;PASSWORD=pass;HOST=server PostgreSQL://PASSWORD=pass;USERNAME=meme;DB_NAME=mydb;HOST=server PostgreSQL://GdaConnection:passsUSERNAME =meme;DB_NAME=mydb;HOST=server PostgreSQL://GdaConnection:passsDB_NAME=mydb;HOST=server;USERNAME=meme]]>< /programlisting>

will return the following new strings (double quotes added here to delimit strings): <programlisting><![CDATA[ out_cnc_params: "DB_NAME=mydb;HOST=server" out_provider: "PostgreSQL" out_username: "meme" out_password: "pass"]]></programlisting>

Parameters:

string

a string in the "[&lt;provider&gt;://][&lt;username&gt;[:&lt;password&gt;]@]&lt;connection_params& gt;" form

out_cnc_params

a place to store the new string containing the &lt;connection_params&gt; part

out_provider

a place to store the new string containing the &lt;provider&gt; part

out_username

a place to store the new string containing the &lt;username&gt; part

out_password

(nullable): a place to store the new string containing the &lt;password&gt; part, or null




2022 vala-language.org