Compare text
About this tool
How to use it
- Choose this tool.
- Paste the older text and the newer text, or add two text files.
- Choose how to compare: by line, word, letter or sentence.
- Press Generate.
- Read the changes on screen or open the coloured page.
What you get back
Try Compare text in the Studio
Use it from your code
cURL
curl -X POST "https://app.h2i.davixlabs.io/v1/documents/text-diff" \
-H "X-Api-Key: $DAVIX_H2I_API_KEY" \
-F 'a=one
two
three' \
-F 'b=one
2
three' \
-F 'mode=line'Node.js
const { DavixH2I } = require('@davixlabs/h2i-sdk');
const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.documents.textDiff({
"a": "one\ntwo\nthree",
"b": "one\n2\nthree",
"mode": "line"
});
console.log(result.data, result.requestId);PHP
<?php
require 'vendor/autoload.php';
$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->documents()->textDiff([
'a' => 'one
two
three',
'b' => 'one
2
three',
'mode' => 'line',
]);
echo $result->requestId;